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 upArithmetic operations with inferred variables take quadratic time to type-check #25916
Comments
huonw
added
I-compiletime
T-compiler
labels
May 31, 2015
This comment has been minimized.
This comment has been minimized.
|
This must be what's making my old macro-abusing inflate implementation take almost 300 seconds in typeck. Having ran callgrind on the sample and also half of it, I'm seeing the following trace:
An unrefined conclusion is that either |
eddyb
added a commit
to eddyb/rust
that referenced
this issue
May 31, 2015
eddyb
referenced this issue
May 31, 2015
Merged
Inline hash_table::calculate_offsets, used by iterators. #25921
This comment has been minimized.
This comment has been minimized.
|
Is this the same issue as #23977? |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis I'm not too familiar with fulfill and infer, but couldn't |
bors
added a commit
that referenced
this issue
May 31, 2015
This comment has been minimized.
This comment has been minimized.
|
We have |
huonw commentedMay 31, 2015
This takes ~2 seconds to type check (according to
-Z time-passes):Doubling (respectively, halving) the number of
f!()invocations multiplies (resp. divides) the time by 4.It applies to arithmetic in
consts/statics too which is, I imagine, where this will occur most often in practice (it's how I found it).Observations:
+,-,*and/, annotating either side (e.g.0 + 0u8) or both sides makes it take only 0.03s and behave linearly (AFAICT)<<and>>:0u8 >> 0) reduces the time to ~1.5s,0 >> 0u8) reduces it to ~1.1s but both are still quadratic,f!to allow easier experimentation)cc @rust-lang/compiler