-
-
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
Some broadcast performance tweaks #19879
Conversation
With this patch, on my machine, I get julia> A = collect(0.0:0.1:100.0);
julia> @benchmark (x->trunc(Int,x)).($A)
BenchmarkTools.Trial:
memory estimate: 8.00 kb
allocs estimate: 1
--------------
minimum time: 2.635 μs (0.00% GC)
median time: 2.738 μs (0.00% GC)
mean time: 3.113 μs (6.93% GC)
maximum time: 124.929 μs (92.14% GC)
--------------
samples: 10000
evals/sample: 9
time tolerance: 5.00%
memory tolerance: 1.00%
julia> @benchmark trunc.(Int, $A)
BenchmarkTools.Trial:
memory estimate: 8.00 kb
allocs estimate: 1
--------------
minimum time: 2.662 μs (0.00% GC)
median time: 2.798 μs (0.00% GC)
mean time: 3.061 μs (6.39% GC)
maximum time: 69.634 μs (90.93% GC)
--------------
samples: 10000
evals/sample: 9
time tolerance: 5.00%
memory tolerance: 1.00% |
Nice. A little off-topic, but I sent you an email (at the address you use in your gitconfig) on new year's eve, did it go to spam? |
I just had a look at the email you sent me (it got lost among a bunch of other emails). That's a really nice new year's surprise. Thank you! |
Let's give my new granted powers a run: @nanosoldier |
I think you need to click a confirm button somewhere, github likes to hide these things |
Found it. Let's try again. @nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels |
I had another idea the other day: To make the outer layer function fixarg{i}(f, ::Type{Val{i}}, v)
(args...) -> begin
f(args[1:i-1]..., v, args[i:end]...)
end
end so that |
like #19724? |
Yes, of course, thanks for the pointer! Let me see whether I can make something useful out of that... |
There's also some discussion of other possible approaches here |
We can't do #19829 for type objects, because there's no "type literal" in Julia... something like |
This allows dot-calls to fully specialize on the first argument when it is a type. The solution here does not extend to type arguments in other positions. For that, something like #19829 for type arguments would be needed, but I'm not sure that is possible in general (except for built-in types).
This PR also allows to remove shape checking in
broadcast!
when applying an@inbounds
to it.Should fix #19849