rust-lang / polonius

Defines the Rust borrow checker.
Apache License 2.0
1.31k stars 74 forks source link

Runaway borrow-check times for `tinyvec` crate #162

Open Byron opened 3 years ago

Byron commented 3 years ago

It can be reproduced with the following script, assuming a nightly compiler is available.

git clone https://github.com/Lokathor/tinyvec
cd tinyvec
git checkout 0e0dc46d37b19d2a350896ed788c84218812b740
cargo +nightly check -Z timings # about 3.5s
mkdir -p .cargo && echo $'[build]\nrustflags = "-Zpolonius"' > .cargo/config.toml
cargo +nightly check -Z timings # about 2m40s

I thought I am posting this here in case it's an interesting use case and maybe even a low-hanging performance issue to resolve. This one stood out as it was the only one out of 114 crates being compiled that showed this kind of worst-case performance. Here is the full timings log.

joshtriplett commented 2 years ago

I ran into this one as well. I found some other crates with similar runaway check times; I'll file issues for those.

demurgos commented 10 months ago

h2 and pulldown-cmark also seem way slower with Polonius. I also have an internal code-generated crate with lots of const/static arrays of strings which is taking ages (over 15 minutes, and still running) (no proc macros there).