You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of rust-lang#137354 - FractalFir:intern_with_cap, r=<try>
[perf experiment] Changed interners to start preallocated with an increased capacity
Inspired by rust-lang#137005.
*Not meant to be merged in its current form*
Added a `with_capacity` function to `InternedSet`. Changed the `CtxtInterners` to start with `InternedSets` preallocated with a capacity.
This *does* increase memory usage at very slightly(by 1 MB at the start), altough that increase quickly disaperars for larger crates(since they require such capacity anyway).
A local perf run indicates this improves compiletimes for small crates(like `ripgrep`), without a negative effect on larger ones:

The current default capacities are choosen somewhat arbitrarily, and are relatively low.
Depending on what kind of memory usage is acceptable, it may be beneficial to increase that capacity for some interners.
From a second local perf run(with capacity of `_type` increased to `131072`), it looks like increasing the size of the preallocated type interner has the biggest impact:

What would be the maximum acceptable memory usage increase? I think most people would not mind sacrificing 1-2MB for an improvement in compile speed, but I am curious what is the general opinion here.
0 commit comments