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 upCrate with large static map in external crate fails to compile #40355
Comments
This comment has been minimized.
This comment has been minimized.
|
Seems like a regression in the |
arielb1
added
I-slow
regression-from-stable-to-beta
T-compiler
labels
Mar 8, 2017
This comment has been minimized.
This comment has been minimized.
|
last good: These are the changes. There’s a number of possibly relevant ones. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
cc @rust-lang/compiler Maybe someone else knows something. |
This comment has been minimized.
This comment has been minimized.
|
Here's a backtrace of where the compiler is after running for a couple of minutes.
|
This comment has been minimized.
This comment has been minimized.
|
This is #38776 (probably this change) - reverting that PR makes things fast again. |
This comment has been minimized.
This comment has been minimized.
|
Huh, why would that not hit caches? Is it because the type needs to be inferred? |
brson
added
the
P-high
label
Mar 9, 2017
This comment has been minimized.
This comment has been minimized.
|
@eddyb I don't know, I think the current system for binops can also be slow sometimes. It's been vaguely on my list to investigate that a bit more and see if there are fast paths we can do. |
This comment has been minimized.
This comment has been minimized.
|
I think this is encountering the O(n^2) quadratic blowup case badly. In that case, we'll have to add "off-main-path" is-not-unsized "obligations". |
This comment has been minimized.
This comment has been minimized.
|
We could also try to solve the O(n^2)ness at the root: for each type variable, maintain a list of obligations it's contained in. Also maintain a stream of changes to type variables. When reselecting, walk over the stream and "unlock" all obligations with type vars inside. I am not sure whether this has better performance than the current approach in the common case. |
This comment has been minimized.
This comment has been minimized.
|
Maybe this is worth doing just for obligations with only int/float variables, tho. |
This comment has been minimized.
This comment has been minimized.
|
@arielb1 I just checked and |
This comment has been minimized.
This comment has been minimized.
|
time: 25.393; rss: 1131MB item-types checking
EDIT2: Sigh, I forgot to pull. |
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
|
What's fast: struct Map {
slice: &'static [i8]
}
static FOO: Map = Map {
slice: &[-1, -1, -1, -1 /* repeated N times */]
};What's slow: struct Map<T: 'static> {
slice: &'static [T]
}
static FOO: Map<i8> = Map {
slice: &[-1, -1, -1, -1 /* repeated N times */]
};This is #31260, I'll just go implement it |
urschrei commentedMar 8, 2017
•
edited
Possibly related: #36799
When attempting to compile https://github.com/urschrei/lonlat_bng using
cargo testorcargo build --releaseon OS X using beta (5276ba7) or nightly (b1e3176), the compilation step doesn't complete (or at least, it hadn't after around 11 hours). It also times out on Linux Nightly and Beta, using Travis.On current OS X Stable (021bd29), it compiles as expected within ~95s locally, and on Linux Stable, using Travis, although
rustdocfor the external crate fails with an OOM error on Linux.This is probably due to the size of the static map in the external crate (https://github.com/urschrei/ostn15_phf), which is around 40.9mb.