-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[clang] Optimize SourceManager.getSpellingLocSlowCase and SourceManager.getFileLocSlowCase #164269
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look correct, but I guess I'm surprised there's any measurable impact on performance; are there performance measurement numbers for these changes? (We have https://llvm-compile-time-tracker.com/ to help measure that sort of thing, FWIW.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably you are correct.
But it looks nicer that way. The performance depends how macro heavy is the source code. I bet you can save a few seconds on the large codebases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found the old code to be easier to understand what was going on, so I worry about premature optimization without some idea of measurements. CC @erichkeane @Sirraide @Endilll for some other opinions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we run the performance test on this RP somehow? Although I doubt that there will be any significant change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, both of these cases are a little tougher to read for me. I'd like to see the perf measurements. I think @Endilll knows how to start them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that PR is more relevant in the context of #163982
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, not trivially; you can contact Nikita to have your fork added (https://llvm-compile-time-tracker.com/about.php) but that may take a while given the upcoming dev conference and folks being busy with that. I think it'd be fine if there were some local tests on whatever project you have that's super macro heavy, something as simple as "average of 1234ms before this patch and 567ms after the patch on my machine" would perhaps help.
Basically, if there's a measurable performance improvement, we can hold our nose on slightly reduced readability, but if there's no measurable performance improvement, there's less of a case for taking the patch..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that helps, here you can follow what LLVM compiler time tracker does.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested the following 3 PRs together, but I don't know how to interpret the results.
#163982
#164269
#163982
full report