Significantly improve diffing performance and fix minor bug with bss section match percents #316
+4,617
−3,114
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.


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?