-
Notifications
You must be signed in to change notification settings - Fork 289
Reduce data copies during internation #3366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
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. |
📌 Commit db16047 has been approved by |
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 -->
☀️ Test successful - status-appveyor, status-taskcluster |
…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
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):
Update
enum 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 theVecHelper
work of Avoid picture primitive copies via VecHelper #3362.This change is