-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
compile-time: massive regression during 2015 #25069
Comments
that improved marginally (edit: I checked that is after the merge)
|
Your code has a >10kLOC method. Couldn't you split it? |
Performance does seem O(n^2) in the number of |
Maybe it is a duplicate of #23977? |
Tested current nightly after the PR to inline hashing better. Only reduces run time of the type checking pass by 6%. |
Did binary search over the nightlies (thanks to multirust); problem was injected between nightly-2015-03-30 and nightly-2015-03-31 In other words, this version is fast:
and this version is slow:
Update: scanning over |
@pnkfelix That's what niko is indicating with the other issue too #23977 (comment) Edit: Awesome job bisecting though! That's a great trick to use. |
I have noticed a similar effect in Servo across a particular Rust upgrade (forgot which). Can we give this priority now that 1.0 is out? |
Are you sure that this is the issue? |
No, I'm not, but regardless, we should be fixing this with priority. |
The problem is that literal inference creates tons of literal variables ( I think of 3 ways to solve this |
In compiler team meeting: we believe this to have been fixed. Would be good to verify whether the perf gap has been corrected in the meantime! |
triage: P-medium |
Has anyone tried benchmarking the compiler? |
I believe @nnethercote has been working on profiling and benchmarking the compiler, and there is also http://perf.rust-lang.org/ which attempts to keeps track of current compile times. Ignore the 18000% regression on perf.rlo right now, we recently changed what we were benchmarking for syntex which caused that jump. |
Yes, I have been doing some benchmarking and profiling. So far I've landed #36734 and #36592, and I just opened #36917. I think there is still some low- to middle-hanging fruit to be picked. I have also done some work on https://github.com/rust-lang-nursery/rustc-benchmarks. I added a script that lets you compare the speed of two different compilers. I also fixed it so that the |
I just took the gist linked earlier and re-ran it on today's compiler. (I had to add some extra The performance of the compiler has not returned to the point where it was at circa March 29th. In particular:
Update: hold on, I just realized that I was looking at September of 2015 in those runs. Let me do a few more. Update 2: Okay, now that I actually looked at runs from 2016, it looks like we have completely recovered all of the lost time, at least on the isolated benchmark in the gist. |
I'm going to close this ticket since I believe we have addressed the specific compile-time regression described here. |
FWIW: that gist contains inflate.rs. A slightly different version of that file is in rustc-benchmarks, which means it's likely to get some attention. In fact, I've already done some profiling for it and found that it is totally dominated by operations involving |
@nnethercote feel free to ping me sometime if you want to look at it a bit together |
That would be expected. The test-case triggers an O(n^2) case in It is possible that this could be made O(n), but the ways seem to have bad overheads in the common case. |
I noticed earlier that the compile time of
image
increased massively during the beginning of 2015. Unfortunately it was hard to quantify this regression since we also changed a lot during this time.Fortunately I just found a good example that shows a 20-fold increase in compile time. It is a single file with no other dependencies (if somebody wants to try: the original version is even much older). The two revisions are exactly the same code, the newer just has been updated to compile on a recent rustc. Note that this is
rustc
only, no time is spend in llvm.(note that something is wrong with the old .pkg-file I used to install rustc, I need to use sudo to run it)
The time profiles show that
driver::phase_1_parse_input
anddriver::phase_2_configure_and_expand
almost stayed constant while the time spent indriver::phase_3_run_analysis_passes
exploded.The text was updated successfully, but these errors were encountered: