-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
IWYU src
folder A-F files
#73040
IWYU src
folder A-F files
#73040
Conversation
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.
Auto-requesting reviews from non-collaborators: @andrei8l
Might be worth checking if you can enable clang-tidy's misc-include-cleaner after these changes. It should remove the need for such PRs in the future. |
I'm 95% sure it would not pass right now, since I didn't finish F-Z. But I would love to do that in the future! |
Would |
The analysis is interesting, but I think the ultimate benefit is counting the number of times particular files are included and seeing which decrease the most. For example, it's only a 1.5% reduction in includes for files A-F, but if it's because eg. |
skipped some files since they were complicated
Trying to fix clang tidy (include CPP style instead of C style headers). This might have been improved in the new IWYU include-what-you-use/include-what-you-use#920 which I don't have. |
The two tests failures are clearly unrelated. |
I think it is better to first IWYU When these are done, much less errors should arise IWYU-ing |
Summary
None
Purpose of change
IWYU changes are good. I stumble upon them randomly
I decided to run it for whole codebase then. But after a day I only got from A to F, so there it is.
Describe the solution
IWYU pragma: keep
, but I believe it could be solved if IWYU was run over all files.Describe alternatives you've considered
First run IWYU for all test files. This would be the right thing to do. It would be easy, as tests are independet of each other unlike
src/
files. However, I have an old IWYU, which doesn't knowIWYU pragma: begin_exports
used in (almost?) all tests and I didn't manage to install IWYU 0.20 which adds that, or newer. I then gave up and made this PR.The benefit of doing tests first instead would be not breaking any test files while changing src includes (since all you use is included not relying on fragile transitive includes). I had to fix some tests affected in the second commit
iwyu: snowball changes
.Testing
src/
andtest/
. Windows, tiles, in Visual Studio.make
command is compiling in on Ubuntu 20.04 through WSL, since that's how I get the IWYU output.Were changes useful?
I don't know how to directly measure compile time apart from letting my PC recompile the whole thing and measure that. I didn't do that.
However, I can count includes in
.inc
files, so I did that, there are the results:counting all includes
Totally negligable result
Counting only includes from /src
0.6% improvement, negligable.
Only count A-F files (but still include all A-Z)
1.5% improvement.
Conclusion
While testing, the transitive includes from G-Z files pollute the relative improvements. The absolute improvement is there, but only the relative improvement can be felt by the programmer, as it says "Compiling will actually take about ~0.6% less time.". That would be 10 seconds out of 1800 seconds.
After these tests, I still think that if IWYU were run for A-Z, transitive includes would be removed much more. I imagine a sigmoid curve. I don't think it would get over 5% reduction in include file count for the whole codebase.
However, for a single change in header time and recompilation, there could be some noticeable compile time reduction, as fewer files need recompilation.
Additional context
IWYU also assumes all
.h
files have a.cpp
file, so I (mostly) didn't touch.h
without a.cpp
file.Tools I used (for my future reference)
iwyu find.ahk
iwyu_parse.py