Improve executor performance #87
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR applies two minor improvements:
Doesn't reduce time complexity, but it reduces the total amount of "operations" done.
The second item seems to be a good improvement as allocation/deallocation is slow.
I have still some tests issues that I'm trying to figure out.Solved!I have done some profiling, though nothing great (I need to create a demo with more entities to get more interesting results)
To profile:
./visualvm_212/bin/visualvmafter extracting the archive.org.ros2.rcljava.examples.subscriber.SubscriberLambda (pid <pid>)entry inLocal.profilertab and addorg.ros2.rcljava.executors.**to the "profile classes:" list.I have compared between this branch and main:
It's reasonable because I'm only testing with one subscription available.
waitForWork() went from taking 50% of the time to 37%.
We still need to test in a more realistic application to confirm.
Note: To make the measurements stable, I have disabled frequently scaling in my machine temporally.
See for example here for details.