Closed
Description
openedon Nov 8, 2023
It's useful for something: https://cds.cern.ch/record/2866130/files/ANA-EXOT-2022-18-PAPER.pdf#page=9
(this is a fitting, so you want this exponential to be very fast)
julia> @benchmark x^y setup=begin x=rand(); y=rand()end
BenchmarkTools.Trial: 10000 samples with 988 evaluations.
Range (min … max): 47.248 ns … 440.931 ns ┊ GC (min … max): 0.00% … 0.00%
Time (median): 47.567 ns ┊ GC (median): 0.00%
Time (mean ± σ): 49.616 ns ± 4.787 ns ┊ GC (mean ± σ): 0.00% ± 0.00%
▅█▇▁ ▂▁ ▁▁▁ ▆▇▄ ▁ ▂
████▁▃▄▁▇██▇▇▆▆▆▆▇███▇▇▆▆▆▆▆▅▇▆▆▆▆▆▆█████▇▇▇▇▇███▆▆▆▅▅▆▅▇▇█▇ █
47.2 ns Histogram: log(frequency) by time 55.5 ns <
Memory estimate: 0 bytes, allocs estimate: 0.
julia> @benchmark x^y setup=begin x=rand(); y=rand(3:9)end
BenchmarkTools.Trial: 10000 samples with 1000 evaluations.
Range (min … max): 2.408 ns … 20.031 ns ┊ GC (min … max): 0.00% … 0.00%
Time (median): 9.003 ns ┊ GC (median): 0.00%
Time (mean ± σ): 8.631 ns ± 2.849 ns ┊ GC (mean ± σ): 0.00% ± 0.00%
▇ ▇ █ █ ▂
█▃▂▂▂▂▂▁▂▂▂▂▁▂▁▁▁▁▁▁▁▁▁▁▁▁▁▂█▂▂▁▃▂▇▄█▇▂▂▂▃█▆▂▂█▃▃▇▂▇▆▂▂▂▂▂ ▃
2.41 ns Histogram: frequency by time 12.7 ns <
Memory estimate: 0 bytes, allocs estimate: 0.
Maybe we're hitting the physical limit of how fast this can go?
In [2]: a=np.random.rand(100);
In [3]: b=np.random.rand(100);
In [5]: %timeit np.power(a,b)
514 ns ± 3.64 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment