Optimize unionfind#294
Merged
christian-rauch merged 1 commit intoAprilRobotics:masterfrom Oct 30, 2023
Merged
Conversation
Collaborator
|
Is this essentially saving you 5ms on the 4896×3264 image? That's a nice improvement. Could you explain in the commit message a bit what the change is doing and why it improves the performance? Glancing over this, Isee it's moving the |
20c196c to
9823431
Compare
Contributor
Author
|
Expanded the commit message a bit. The savings is indeed from using |
Collaborator
|
Can you remove the concrete ~4% from the commit message again? I guess this value depends a lot on the image resolution and is not the same improvement in all cases. |
* Split up data into parent and size arrays * Use memset to initialize parent and size arrays in one go instead of iterating
9823431 to
08465f4
Compare
Contributor
Author
|
Sure, removed |
christian-rauch
approved these changes
Oct 30, 2023
Collaborator
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I figured out that a big part of the union find time spent was initializing the data array. I've optimized it by using two
memsets instead of an array, which saves ~4% for an image sized 4896×3264Before
After