Significantly improve diffing performance and fix minor bug with bss section match percents by LagoLunatic · Pull Request #316 · encounter/objdiff
When I mentioned the bug in diff_bss_section, I was referring to this:
| let left_section = &left_obj.sections[left_section_idx]; | |
| let left_sizes = symbols_matching_section(&left_obj.symbols, left_section_idx) | |
| .filter_map(|(_, s)| s.address.checked_sub(left_section.address).map(|a| (a, s.size))) | |
| .collect::<Vec<_>>(); | |
| let right_section = &right_obj.sections[right_section_idx]; | |
| let right_sizes = symbols_matching_section(&right_obj.symbols, right_section_idx) | |
| .filter_map(|(_, s)| s.address.checked_sub(right_section.address).map(|a| (a, s.size))) | |
| .collect::<Vec<_>>(); | |
| let ops = capture_diff_slices(Algorithm::Patience, &left_sizes, &right_sizes); | |
| let mut match_percent = get_diff_ratio(&ops, left_sizes.len(), right_sizes.len()) * 100.0; |
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.