perf(transformer): common transforms store state in UnsafeCell#6246
Conversation
Your org has enabled the Graphite merge queue for merging into mainAdd the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @overlookmotel and the rest of your teammates on |
6a632df to
a0a3a8b
Compare
3c7e1aa to
e2f2ec8
Compare
CodSpeed Performance ReportMerging #6246 will not alter performanceComparing Summary
|
e2f2ec8 to
810cfb5
Compare
|
Only +0.2% perf boost at best. I'm really surprised. Perhaps I've done it wrong, or perhaps compiler was able to deduce that |

Experiment. Not for merging.
As an alternative to #11742, we could wrap state in common transforms in
UnsafeCellinstead ofRefCell. We'd need a nice way to do that (probably would have to be a proc macro, unfortunately). This PR just does it manually with an ugly method, to see what the perf gain is, and so how worthwhile it would be to do it properly.