Weight a unique function by its best match, not its last (#157) - #166
Merged
danielplohmann merged 2 commits intoSep 8, 2026
Merged
Conversation
getUniqueFamilyMatchInfoForSample assigned the score-weighted bytes of a function on every match, so the value that survived was the match iterated last rather than the best one, while the families and samples beside it were accumulated. The "unique" percentage on the 1-vs-N result page was therefore order-dependent (danielplohmann#157). The assignment is a max() now, and the test checks the score against a fixture whose matches are spread over different scores, in both iteration orders.
A function matched in several samples of its one family credited every sample with its best score overall; the maximum is now per (function, sample), which is what each sample's bytes are made of. Test covers two differently scored samples of one family.
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.
Closes #157.
getUniqueFamilyMatchInfoForSampleassigned the score-weighted bytes of a function on every match, so the value that survived was whichever match was iterated last, while the family and sample sets beside it were accumulated. The "unique" percentage on the 1-vs-N page was order-dependent. The assignment ismax()now.The test spreads the fixture's matches over different scores (the captured report scores every match of a function alike, which is why this went unnoticed), computes the expected best-per-function bytes for functions unique to one family, and checks the result in both iteration orders; it fails on
main.ruff,tyand the full suite pass.