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 upReduce data copies during internation #3366
Conversation
|
Should we confirm this is a talos win before merging? |
|
@gw3583 yep, will do Also need to confirm with the playground, since in this case (unlike with Allocation) we still have a branch separating an item constructor from the target location, even though it's not a panicing one. |
…es even more
|
Interestingly, a Playground experiment shows a reduction of LLVM copy calls from 4 to 0 when using this change. Seems pretty ridiculous, you are encouraged to play with it and maybe tell what I'm doing wrong :) |
|
Here's what my tool can tell us about where the copies are coming from:
4 copies does seem excessive, but it is facts. |
|
@jrmuizel thanks for confirmation! It's going to be a big win then :) |
|
It would be worth comparing before/after on webrender.ll. You should be able to avoid the verification errors by using rust nightly. (That fixed it for me) |
|
@jrmuizel I'm not seeing as good of a picture as in playground (and yes, nightly works). The change of a first commit strips away a few larger memcopies, but the Edit: here are the dumps: memcpy-logs.zip |
|
I suspect we're not seeing the improvement we expect because of rust-lang/rust#56191. @nikic has a patch to llvm that might improve things here. |
|
Let's not get this rot for too long. |
|
|
Reduce data copies during internation Excessive copying in `fn intern()` is something we noticed yesterday with @jrmuizel . This PR attempts to improve them in two ways (each in a separate commit): 1. reduce the `Update` enum size by moving the data out 2. adopt entry-like API to accommodate the common pattern of `if index == v.len() { v.push(xxx) } else { v[index] = xxx; }` without panics between element construction and actual assignment. It builds upon the `VecHelper` work of #3362. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/3366) <!-- Reviewable:end -->
|
|
…7216ff3cdbc2 (WR PR #3366). r=kats servo/webrender#3366 Differential Revision: https://phabricator.services.mozilla.com/D13627 --HG-- extra : moz-landing-system : lando
…7216ff3cdbc2 (WR PR #3366). r=kats servo/webrender#3366 Differential Revision: https://phabricator.services.mozilla.com/D13627
|
Got 5% improvement in dl_mutate from that: https://treeherder.mozilla.org/perf.html#/alerts?id=18030 |
…7216ff3cdbc2 (WR PR #3366). r=kats servo/webrender#3366 Differential Revision: https://phabricator.services.mozilla.com/D13627 UltraBlame original commit: df8c8aa616045a2076d1f0c8b1ebedf322aec212
…7216ff3cdbc2 (WR PR #3366). r=kats servo/webrender#3366 Differential Revision: https://phabricator.services.mozilla.com/D13627 UltraBlame original commit: df8c8aa616045a2076d1f0c8b1ebedf322aec212
…7216ff3cdbc2 (WR PR #3366). r=kats servo/webrender#3366 Differential Revision: https://phabricator.services.mozilla.com/D13627 UltraBlame original commit: df8c8aa616045a2076d1f0c8b1ebedf322aec212
kvark commentedNov 28, 2018
•
edited by larsbergstrom
Excessive copying in
fn intern()is something we noticed yesterday with @jrmuizel .This PR attempts to improve them in two ways (each in a separate commit):
Updateenum size by moving the data outif index == v.len() { v.push(xxx) } else { v[index] = xxx; }without panics between element construction and actual assignment. It builds upon theVecHelperwork of #3362.This change is