-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add fast path for merge with Dicts #22737
Conversation
Any benchmarks to share? |
Can do when I get home tonight. The quick benchmark in #22519 shows best-case improvements. Methodology-wise, I saw no slowdown vs a specialized method restricted to known, shared key and value types. |
There's already an EDIT: maybe giving it another name since it seems it's faster to make a copy than allocating a new dict, but you could keep the existing mechanism. |
Exactly, |
Actually I think I'd suggest merging |
Good call. Once I went to combine helper functions, I realized all three previous paths were covered by well by either Timings confused me benchmarking, though. I tried a few variations before I realized the noise was just a matter of whether or not BenchmarkTools inlined the I assume that's just an artifact of the benchmarking and I don't want to force |
That looks pretty simple. Dunno if any existing benchmarks would cover this, if not might be worth adding some new ones to BaseBenchmarks to track it. @nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan |
I'd be happy to add a benchmark or two, but I'm still a little confused about the interaction between BenchmarkTools and inlining from that benchmarking script: i.e. I needed to force inlining in benchmarking to see the comparison I expected, and I didn't think merge was something you'd force inlining on. |
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.
superficially lgtm :).
we should probably rename the existing benchmark label to needs-benchmark rather than adding a new near-duplicate one, since that's most of what it's been used for by jrevels and myself ever since it was first added |
It was unclear to me that this was what the |
Ah, yes, how could I have missed that one-line comment from two years ago? I've renamed the label to make its meaning clear without ancient comment spelunking. |
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.
Looks good to me too. I wish we could find an even more explicit name, but without using a full sentence that doesn't sound possible. :-)
Here, |
I don't see any difference between explicit inlining or not anymore. Will rerun CI and merge if green. |
A hair slower if length(Dict) == 1, faster generally.
Closes #22519