-
Notifications
You must be signed in to change notification settings - Fork 15
excessive compile time building linux/lib/zstd/compress.c #1314
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
Comments
I played around with this a little and found that -fsanitize=kernel-hwaddress is the main reason for the slow compilation, without this, compile time goes down to 12 seconds instead of 27. |
IIRC, doesn't this file have __always_inline on every function? I remember there was one zstd related file that had a relatively large time spent in the optimizer than the frontend, unlike most other source files. #1086 (comment) is when I looked at it, though it seems I failed to make such notes public... |
cc @eugenis for feedback on |
Indeed, removing every __always_inline in the preprocessed file makes compilation three to four times faster, both with and without -fsanitize=kernel-address. With both kasan and always_inline removed, the file now compiles in three seconds, which is still rather slow, but is ten times faster than the maximum I found. |
Comparing clang-13 against gcc-10:
|
This one seems related but even worse, at over 100 CPU seconds to compile the preprocessed file with KASAN:
Without KASAN, it takes 7.6s to compile. With gcc, it's 4.6.s with kasan or 4.0s without kasan. |
I found that this one-line change reduces the build time from 104 seconds to 2.7 seconds:
|
I ran the qla_dbg test case (without the noinline) through a "clang-13 -ftime-report" (full report attached), the interesting bits are
The results are the same for earlier versions of clang (tested 10 and up), so this is not a regression. |
Here is a reduced test case for qla_dbg.c, which comes down to the same function getting inline many times when probably should not be inlined. |
I did a scripted search for files with long compile time. lib/zstd/compress.c is one of the files that came out on top.
Attaching the preprocessed version:
compress.i.gz
The profile shows these functions on top:
The text was updated successfully, but these errors were encountered: