Skip to content

Improve symbol name normalization #1843

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Mar 10, 2024
Merged

Conversation

erikdesjardins
Copy link
Contributor

It seems that hashes can be 17 characters, so with the old code you can end up with a diff for every symbol:

│ gimli::read::unit::AttributeValue<R,Offset>::udata_value::4 │ 86 B │  0 B │ -86 │ -100.0% │
│ gimli::read::unit::AttributeValue<R,Offset>::udata_value::3 │  0 B │ 86 B │ +86 │ +100.0% │

Also, remove the preceding :: if it exists, and add word boundaries to make it slightly more precise.

This makes the diff usable for the changes in rust-lang/rust#121665 (comment), e.g. when running cargo run --bin collector --release binary_stats --symbols +516b6162a2ea8e66678c09e8243ebd83e4b8eeea --rustc2 +70aa0b86c066e721012852a9851fdf8586117823 --include helloworld.

For the symbols above, I now get

gimli::read::unit::AttributeValue<R,Offset>::udata_value

with zero size diff, as expected.

Copy link
Contributor

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! This code is quite hacky, but I don't know any better way to do it.

@Kobzol Kobzol merged commit e3d8ef8 into rust-lang:master Mar 10, 2024
@erikdesjardins erikdesjardins deleted the normal branch March 10, 2024 22:15
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants