Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upcompile-time: massive regression during 2015 #25069
Comments
huonw
added
the
I-compiletime
label
May 3, 2015
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
that improved marginally (edit: I checked that is after the merge)
|
This comment has been minimized.
This comment has been minimized.
|
Your code has a >10kLOC method. Couldn't you split it? |
This comment has been minimized.
This comment has been minimized.
|
Performance does seem O(n^2) in the number of |
This comment has been minimized.
This comment has been minimized.
|
Maybe it is a duplicate of #23977? |
This comment has been minimized.
This comment has been minimized.
|
Tested current nightly after the PR to inline hashing better. Only reduces run time of the type checking pass by 6%. |
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
@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. |
This comment has been minimized.
This comment has been minimized.
|
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? |
This comment has been minimized.
This comment has been minimized.
|
Are you sure that this is the issue? |
This comment has been minimized.
This comment has been minimized.
|
No, I'm not, but regardless, we should be fixing this with priority. |
This comment has been minimized.
This comment has been minimized.
|
The problem is that literal inference creates tons of literal variables ( I think of 3 ways to solve this |
arielb1
referenced this issue
Jun 2, 2015
Closed
Arithmetic operations with inferred variables take quadratic time to type-check #25916
JohanLorenzo
referenced this issue
Mar 2, 2016
Open
Reduce compile (and test) time: Split FoxBox into many small crates #113
pnkfelix
added
the
T-compiler
label
Jun 2, 2016
This comment has been minimized.
This comment has been minimized.
pnkfelix
added
the
I-nominated
label
Jun 2, 2016
This comment has been minimized.
This comment has been minimized.
|
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! |
nikomatsakis
removed
the
I-nominated
label
Jun 2, 2016
This comment has been minimized.
This comment has been minimized.
|
triage: P-medium |
rust-highfive
added
the
P-medium
label
Jun 2, 2016
This comment has been minimized.
This comment has been minimized.
|
Has anyone tried benchmarking the compiler? |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
|
I'm going to close this ticket since I believe we have addressed the specific compile-time regression described here. |
pnkfelix
closed this
Oct 3, 2016
This comment has been minimized.
This comment has been minimized.
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 |
This comment has been minimized.
This comment has been minimized.
|
@nnethercote feel free to ping me sometime if you want to look at it a bit together |
This comment has been minimized.
This comment has been minimized.
|
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. |
nwin commentedMay 3, 2015
I noticed earlier that the compile time of
imageincreased 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
rustconly, 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_inputanddriver::phase_2_configure_and_expandalmost stayed constant while the time spent indriver::phase_3_run_analysis_passesexploded.