-
-
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
small optimization to f(...; kw...)
when kw
is empty
#21601
Conversation
877520d
to
1ab70ea
Compare
Ha, that failure was a good puzzle. Apparently |
@@ -848,6 +848,9 @@ function testset_beginend(args, tests) | |||
# action (such as reporting the results) | |||
quote | |||
ts = $(testsettype)($desc; $options...) | |||
# this empty loop is here to force the block to be compiled, | |||
# which is needed for backtrace scrubbing to work correctly. | |||
while false; end |
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.
this doesn't seem fragile at all
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.
Ok, suggest an alternative. There is a test for this at least.
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.
Would putting it in a let
work?
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.
I think this should be fine. If we change the front-end heuristics, we'll worry about this then. Probably by then backtrace scrubbing will be decoupled from compilation anyways.
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.
But maybe put a comment on whichever test led you to notice this, as a breadcrumb for the next person who runs into this?
@nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels |
Chances are the potential regressions are noise. But it's dangerous to go alone, so take this tiny metal pegasus @nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels |
The potential |
They're consistently inconsistent :) |
1ab70ea
to
cd48075
Compare
|
cd48075
to
057fa2a
Compare
Found a modest piece of low-hanging fruit here. In this case, we were "copying" the container
kw
to a new (empty) array, and then checking whether that is empty, when we could just check whetherkw
is empty. This comes up a lot in definitions like(e.g.
remotecall
), where allocating an unnecessary empty array has significant overhead for what should be a no-op. This shaves off another ~10% of the memory allocated in the benchmark in #21543.This also takes advantage of some common cases where
kw
has a known length, where before we always copied it usingpush!
.