Use zeroed allocations in the mir interpreter instead eagerly touching the memor...
source link: https://github.com/rust-lang/rust/pull/87777
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
#86255 introduced a 30% regression in page faults and a 3% regression in max-rss in the ctfe-stress benchmarks.
That's most likely happened because it separated allocation from initialization of the vec which defeats the zero-optimization.
Currently there's no allocation API that is fallible, zeroing and returns a slice, so this PR introduces one and then uses that to solve the problem. In principle vec.resize(len, 0)
could be optimized to use alloc::grow_zeroed
where appropriate but that would require new specializations and new plumbing in RawVec
.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK