-
Notifications
You must be signed in to change notification settings - Fork 1
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
abuse of 'inline fn' #5
Comments
Thanks Andrew. Great comment. I create no_inline brach where I removed all of them. But didn't actually reproduce your result (is there a chance that you switch what is new and what old in inflate_bench results). I got this for inflate_bench. First is code from main branch and second is with all inlines removed.
For deflate differences were very small. I then started with original inflate code and removed inlines except for few of them for which I found that have some impact.
|
The first thing I did was remove all of them, and I observed similar results as you. Then I reverted a handful of files and tried again, and got the results that I shared above. The diff I provided shows which functions in particular I removed To reiterate, the diff I provided above is not removing all inline functions. If you want to try the diff you can copy it, open a terminal, cd to flate, run |
This may be due to random changes in layout causing big differences in performance due to locality. This is a known problem with trying to do benchmarking like this. There is not a simple way to avoid this. Perhaps it would make sense to collect measurements only after running the binary through BOLT |
When testing whether an inline has effect or not should I compare ReleaseSafe or ReleaseFast builds. I see some cases where single inline has huge impact in ReleaseSafe but no impact in ReleaseFast. By putting that inline I'm somehow turning ReleaseSafe to ReleaseFast. |
ReleaseFast for sure. ReleaseSafe is appropriate for code with high churn, not a fuzz-tested library of unchanging code. |
Hi, this is some exciting work.
I want to call attention to what the language reference has to say about inline functions:
I noticed that
inline fn
is used quite a bit and I was wondering if it is actually required for performance?To test this, I took a random sample and removed the
inline
keyword:Then I observed a significant performance improvement in inflate_bench (ReleaseFast):
It also caused the binary size to shrink by 28K.
For deflate, I observed no significant performance difference in wall time and a shrinking of only 5K:
In conclusion, my suggestion is to delete
inline
from all the functions, and then do some more performance testing and determine where it needs to be added back. Probably only 1 or 2 places.The text was updated successfully, but these errors were encountered: