Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Remove Box from RcSlice #51281
Remove Box from RcSlice #51281
Conversation
This isn't necessary as Rc/Arc already have an internal heap allocation, so the additional Box represented a useless pointer dereference.
|
(rust_highfive has picked a reviewer for you, use r? to override) |
|
cc @nnethercote |
|
Nice! I actually looked at this myself because these allocations were showing up as moderately hot in some profiles, but I managed to convince myself they were unavoidable O_o |
|
r? @eddyb |
|
Note that there is a cost here of moving the contents into an |
|
@bors try |
Remove Box from RcSlice This isn't necessary as Rc/Arc already have an internal heap allocation, so the additional Box represented a useless pointer dereference.
|
|
|
@nnethercote This does seem to be a regression in wall time and memory usage.. https://perf.rust-lang.org/compare.html?start=685faa2c3ee062aaf30ddf6d3daf4ef3b576979b&end=d9589e4c2db96769a2be22f29625cb31266557cc&stat=max-rss. I guess maybe we shouldn't land this? Is your interpretation different? |
|
I took a look at deep-vector and regex with Cachegrind and DHAT. deep-vector because it showed the big regression, and regex because DHAT shows its the benchmark that has the highest proportion of these RcSlice allocations. DHAT agrees that the max RSS does increase significantly for deep-vector. (I get a 16% increase on a clean-check build.) Presumably because we end up having two copies of the data live while copying from the Vector to the slice. Other than that, there's not much change -- regex is hardly affected -- and no clear benefit. The total number of allocations done doesn't change. Instruction counts don't change. It's a shame, but I agree that this shouldn't be landed. |
|
Thanks for verifying! |
This isn't necessary as Rc/Arc already have an internal heap allocation,
so the additional Box represented a useless pointer dereference.