here’s master with those same functions:
julia> show(stdout, MIME("text/plain"), @benchmark f1($10.0)); println()
BenchmarkTools.Trial: 10000 samples with 1 evaluation per sample.
Range (min … max): 154.901 μs … 1.272 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 166.506 μs ┊ GC (median): 0.00%
Time (mean ± σ): 174.343 μs ± 26.890 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
▃█▇▄▂▃▃▃▃▃▄▃▃▂▂▁▁▁▁ ▁
▅▅▂▄██████████████████████▇▇▇▆▆▇▆▆▆▆▅▆▆▆▄▆▅▅▅▂▅▃▄▅▅▅▂▂▄▄▃▄▂▅ █
155 μs Histogram: log(frequency) by time 266 μs <
Memory estimate: 32 bytes, allocs estimate: 2.
julia> show(stdout, MIME("text/plain"), @benchmark f2($10.0)); println()
BenchmarkTools.Trial: 10000 samples with 4 evaluations per sample.
Range (min … max): 6.750 μs … 422.931 μs ┊ GC (min … max): 0.00% … 94.64%
Time (median): 7.289 μs ┊ GC (median): 0.00%
Time (mean ± σ): 8.438 μs ± 16.250 μs ┊ GC (mean ± σ): 7.69% ± 3.94%
▇██▇▅▄▃▂▂▁▁▁▁▁ ▂
▄▂███████████████████████████▇████▇▇█▆█▇▆▇▆▅▆▆▆▄▆▅▄▅▅▄▃▄▄▄▅ █
6.75 μs Histogram: log(frequency) by time 13.9 μs <
Memory estimate: 7.88 KiB, allocs estimate: 3.
julia> show(stdout, MIME("text/plain"), @benchmark f3($10.0)); println()
BenchmarkTools.Trial: 10000 samples with 5 evaluations per sample.
Range (min … max): 5.783 μs … 62.308 μs ┊ GC (min … max): 0.00% … 0.00%
Time (median): 6.863 μs ┊ GC (median): 0.00%
Time (mean ± σ): 7.457 μs ± 1.904 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
▁ █▇▃▁▂ ▂█▁ ▄▁▁▁▁▁ ▁ ▁ ▁ ▄▁ ▂
█▅▁▅▄██████▇████▇█████████████████▆█▇▇▇▇▆▆▆▇▆▅▆▆▅▆▅██▆▆▆▆▆ █
5.78 μs Histogram: log(frequency) by time 12.8 μs <
Memory estimate: 0 bytes, allocs estimate: 0.
julia> show(stdout, MIME("text/plain"), @benchmark f4($10.0)); println()
BenchmarkTools.Trial: 10000 samples with 5 evaluations per sample.
Range (min … max): 5.784 μs … 29.078 μs ┊ GC (min … max): 0.00% … 0.00%
Time (median): 6.548 μs ┊ GC (median): 0.00%
Time (mean ± σ): 6.780 μs ± 913.185 ns ┊ GC (mean ± σ): 0.00% ± 0.00%
▁ ██▂▁▁ ▁▁ ▂
█▄▁▁▄▃▁▃█████████████▇█▇███▇▇▇▇▇▇▇▇▇▇▇▇▇█▆▇▇█▇▇▆▇▇▆▇▇▅▆▆▅▄▆ █
5.78 μs Histogram: log(frequency) by time 10.7 μs <
Memory estimate: 0 bytes, allocs estimate: 0.
julia> #now let them compile everything away by removing the $
julia> show(stdout, MIME("text/plain"), @benchmark f1(10.0)); println()
BenchmarkTools.Trial: 10000 samples with 1 evaluation per sample.
Range (min … max): 162.456 μs … 586.251 μs ┊ GC (min … max): 0.00% … 0.00%
Time (median): 166.788 μs ┊ GC (median): 0.00%
Time (mean ± σ): 178.351 μs ± 25.721 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
▄█▇▄▄▄▃▃▃▂▂▂▃▃▁▁▁▁▁▁ ▂▃▁ ▁ ▁▂▁ ▂
██████████████████████████████▇▇▇▇▆▇▆▇▆▇▆▆▅▇█████▇▇▇▆▅▆▅▅▅▂▄▄ █
162 μs Histogram: log(frequency) by time 263 μs <
Memory estimate: 32 bytes, allocs estimate: 2.
julia> show(stdout, MIME("text/plain"), @benchmark f2(10.0)); println()
BenchmarkTools.Trial: 10000 samples with 5 evaluations per sample.
Range (min … max): 6.937 μs … 776.736 μs ┊ GC (min … max): 0.00% … 87.47%
Time (median): 7.812 μs ┊ GC (median): 0.00%
Time (mean ± σ): 9.227 μs ± 19.372 μs ┊ GC (mean ± σ): 8.45% ± 4.15%
▇█▇▅▄▅▆▆▅▄▄▃▂▂▂▂▂▁▁▁▁▁ ▁ ▁▁ ▁▁▂▂▁ ▂
███████████████████████████████▇▇▇▆▆▆██████▇▆▇▇▆▇▆▆▆▆▆▅▅▅▄▅ █
6.94 μs Histogram: log(frequency) by time 16.2 μs <
Memory estimate: 7.85 KiB, allocs estimate: 2.
julia> show(stdout, MIME("text/plain"), @benchmark f3(10.0)); println()
BenchmarkTools.Trial: 10000 samples with 999 evaluations per sample.
Range (min … max): 9.012 ns … 128.866 ns ┊ GC (min … max): 0.00% … 0.00%
Time (median): 9.093 ns ┊ GC (median): 0.00%
Time (mean ± σ): 9.759 ns ± 2.875 ns ┊ GC (mean ± σ): 0.00% ± 0.00%
█▅▂▁ ▃ ▃▁ ▁▂ ▂▅▃ ▁
████▇█▆▆▆▄██▅▃▃▄██▁▅▄▄▁████▇▅▅▅▄▄▅▅▅▁▄▅▅▅▅▅▃▄▄▄▄▄▃▄▄▃▄▄▄▁▄▄ █
9.01 ns Histogram: log(frequency) by time 15.5 ns <
Memory estimate: 0 bytes, allocs estimate: 0.
julia> show(stdout, MIME("text/plain"), @benchmark f4(10.0)); println()
BenchmarkTools.Trial: 10000 samples with 999 evaluations per sample.
Range (min … max): 8.841 ns … 114.111 ns ┊ GC (min … max): 0.00% … 0.00%
Time (median): 9.141 ns ┊ GC (median): 0.00%
Time (mean ± σ): 9.885 ns ± 2.716 ns ┊ GC (mean ± σ): 0.00% ± 0.00%
█▇█▃▂ ▃ ▆▅▂ ▂
██████████▇▇▆██▇▇▆██████▇▇▇▆▆▆▇▅▆▅▅▅▇▆▆▆▆▆▅▆▆▆▅▆▆▅▄▁▆▅▅▅▆▄▆ █
8.84 ns Histogram: log(frequency) by time 17.4 ns <
Memory estimate: 0 bytes, allocs estimate: 0.
here’s the above again, with release on the same computer:
julia> show(stdout, MIME("text/plain"), @benchmark f1($10.0)); println()
BenchmarkTools.Trial: 10000 samples with 1 evaluation per sample.
Range (min … max): 160.846 μs … 742.954 μs ┊ GC (min … max): 0.00% … 0.00%
Time (median): 173.678 μs ┊ GC (median): 0.00%
Time (mean ± σ): 190.036 μs ± 35.612 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
▆█▇▅▄▃▃▂▃▄▅▃▃▂▃▄▄▂▂▂▁▁▂▁▁▁▁ ▁ ▃▄▃▂▂▁ ▁ ▂
██████████████████████████████████████▇█▇▇▆▆▅▆▅▅▄▃▄▄▄▃▅▅▅██▄▆ █
161 μs Histogram: log(frequency) by time 311 μs <
Memory estimate: 32 bytes, allocs estimate: 2.
julia> show(stdout, MIME("text/plain"), @benchmark f2($10.0)); println()
BenchmarkTools.Trial: 10000 samples with 4 evaluations per sample.
Range (min … max): 7.054 μs … 645.076 μs ┊ GC (min … max): 0.00% … 81.21%
Time (median): 8.277 μs ┊ GC (median): 0.00%
Time (mean ± σ): 9.690 μs ± 24.047 μs ┊ GC (mean ± σ): 9.79% ± 4.01%
▂▄▅▃▂▂▂▂▄▇█▇▅▃▃▄▃▂▂▁▂▁▁▁▁ ▁▂▂ ▂
█████████████████████████████████▇▇▇▇▇▇▇▇▆▆▅▅▆▅▅▅▅▅▅▅▄▂▄▅▄▄ █
7.05 μs Histogram: log(frequency) by time 13.8 μs <
Memory estimate: 7.88 KiB, allocs estimate: 3.
julia> show(stdout, MIME("text/plain"), @benchmark f3($10.0)); println()
BenchmarkTools.Trial: 10000 samples with 5 evaluations per sample.
Range (min … max): 5.780 μs … 99.489 μs ┊ GC (min … max): 0.00% … 0.00%
Time (median): 6.541 μs ┊ GC (median): 0.00%
Time (mean ± σ): 6.771 μs ± 1.322 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
▆█▃▁ ▁▁ ▁
█▄▃▁▄▃████▇██████▇▇▇▇▇▇▇▆▇▆▇▇▇▇▅▇█▇▇▆▆▆▆▆▆▆▆▄▆▆▅▆▅▄▅▆▃▅▅▆▆ █
5.78 μs Histogram: log(frequency) by time 11.7 μs <
Memory estimate: 0 bytes, allocs estimate: 0.
julia> show(stdout, MIME("text/plain"), @benchmark f4($10.0)); println()
BenchmarkTools.Trial: 10000 samples with 5 evaluations per sample.
Range (min … max): 5.787 μs … 36.082 μs ┊ GC (min … max): 0.00% … 0.00%
Time (median): 6.555 μs ┊ GC (median): 0.00%
Time (mean ± σ): 6.893 μs ± 1.067 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
█▄▂▁ ▁ ▁
▄▃▁▁▁▃▆███████▇██▇▇█████▇██▇███████▇██▇▇▇▆▆▆▆▇▇▅▆▅▆▇▅▅▅▆▆▅ █
5.79 μs Histogram: log(frequency) by time 11.5 μs <
Memory estimate: 0 bytes, allocs estimate: 0.
julia> # now without the $ for full compilation magic
julia> show(stdout, MIME("text/plain"), @benchmark f1(10.0)); println()
BenchmarkTools.Trial: 10000 samples with 1 evaluation per sample.
Range (min … max): 160.282 μs … 2.132 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 169.225 μs ┊ GC (median): 0.00%
Time (mean ± σ): 180.205 μs ± 41.184 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
▆█▆▄▄▃▃▃▃▅▆▅▄▃▂▂▁▁▁ ▁ ▂
██████████████████████▇▇▆█▇▆▆▇▇██▇▇▆▆▅▆▅▄▅▅▄▆▅▄▄▄▄▆▃▅▃▄▂▂▄▆▆ █
160 μs Histogram: log(frequency) by time 307 μs <
Memory estimate: 32 bytes, allocs estimate: 2.
julia> show(stdout, MIME("text/plain"), @benchmark f2(10.0)); println()
BenchmarkTools.Trial: 10000 samples with 4 evaluations per sample.
Range (min … max): 6.568 μs … 639.685 μs ┊ GC (min … max): 0.00% … 83.01%
Time (median): 7.432 μs ┊ GC (median): 0.00%
Time (mean ± σ): 9.166 μs ± 18.370 μs ┊ GC (mean ± σ): 8.23% ± 4.27%
▆█▇▄▃▃▁▃▂▁▄▅▄▂▂▃▂▁ ▁▃▄▃▁ ▂
▄▄▁██████████████████████████████▇▇█▇▆▇▇▆▆▅▆▅▆▅▅▄▅▄▄▄▄▄▄▄▄▅ █
6.57 μs Histogram: log(frequency) by time 15.9 μs <
Memory estimate: 7.88 KiB, allocs estimate: 3.
julia> show(stdout, MIME("text/plain"), @benchmark f3(10.0)); println()
BenchmarkTools.Trial: 10000 samples with 6 evaluations per sample.
Range (min … max): 5.780 μs … 174.387 μs ┊ GC (min … max): 0.00% … 0.00%
Time (median): 6.538 μs ┊ GC (median): 0.00%
Time (mean ± σ): 7.630 μs ± 2.717 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
█▅▂▁▁▁▁▁ ▁ ▂ ▁ ▃ ▂▅ ▁
▅▁▁▁▃██████████████████████████████▇▇▇▇▆▆▇▆▆▆▅▅▅██▆▆▅▆▄▄▆▅▇ █
5.78 μs Histogram: log(frequency) by time 13.3 μs <
Memory estimate: 0 bytes, allocs estimate: 0.
julia> show(stdout, MIME("text/plain"), @benchmark f4(10.0)); println()
BenchmarkTools.Trial: 10000 samples with 6 evaluations per sample.
Range (min … max): 5.836 μs … 39.879 μs ┊ GC (min … max): 0.00% … 0.00%
Time (median): 6.549 μs ┊ GC (median): 0.00%
Time (mean ± σ): 6.889 μs ± 1.223 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
█▃▁ ▁▁▁▂ ▂ ▁
▃▁▁▁▁████████████▇██▇▇▇▆▇▇▇▇▇▇▇▇▇██▆▆▆▆▆▅▆▆▅▅▆▅▅▅▅▅▅▅▅▄▅▄▇ █
5.84 μs Histogram: log(frequency) by time 12.1 μs <
Memory estimate: 0 bytes, allocs estimate: 0.