-
Notifications
You must be signed in to change notification settings - Fork 52
Significantly improve diffing performance and fix minor bug with bss section match percents #316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This fixes an underreport bug in diff_bss_section.
|
When I mentioned the bug in objdiff/objdiff-core/src/diff/data.rs Lines 564 to 573 in 7834185
Notice how it takes the bss symbols in the section and compares their sizes without sorting them first. This PR sorts everything when reading the object, so that's why the bug is now fixed, is what I was getting at. |
|
I see By doing I don't know the correct solution for this so i've left it be until now |
|
Are you saying the performance degradation from #255 still exists after this PR? Or is it fixed now? This PR did move your |
|
Oh I didn't see that you already sent objects in Discord DMs. I tried diffing them on this PR and it's more than 2x faster now, so yeah I think that issue is also resolved by the first commit of this PR. |


First commit optimizes diffing by moving the expensive string processing logic out of the loops being run to compare every symbol to every other symbol, and instead doing the logic just once while reading the object so that simple string equals checks can be used in the loop.
Second commit optimizes diffing more by using min in the loops instead of sorting.
Third commit optimizes this same part even further by removing the min in the loop and instead sorting all symbols once when the object is read. Moving the sorting earlier had the unintended side effect of fixing a subtle bug in
diff_bss_sectionthat I didn't know about: it assumes the bss symbols are in order and only compares their sizes, so when they're not in the right order it will report <100% if the bss symbol names don't match. Now it doesn't care about bss symbol names as long as the sizes match - this was the originally intended behavior fordiff_bss_section, right?Related: #273