I have both 1.8.0-rc3 and 1.7.2 installed. I am running the simple benchmark
using BenchmarkTools; @benchmark a + b setup=(b = rand(Int64); a = rand(Int64))
which from my understanding, should really just be measuring my CPU speed. In 1.7.2, the results are
BenchmarkTools.Trial: 10000 samples with 1000 evaluations.
Range (min … max): 1.200 ns … 2.890 ns ┊ GC (min … max): 0.00% … 0.00%
Time (median): 1.210 ns ┊ GC (median): 0.00%
Time (mean ± σ): 1.211 ns ± 0.043 ns ┊ GC (mean ± σ): 0.00% ± 0.00%
▂█
██▂▃▁▁▁▂▁▁▁▁▁▂▁▁▁▂▁▁▁▁▂▁▂▁▂▁▂▁▂▁▁▁▁▁▁▂▁▂▁▁▁▁▁▂▁▂▁▂▁▂▁▁▁▁▂ ▂
1.2 ns Histogram: frequency by time 1.5 ns <
Memory estimate: 0 bytes, allocs estimate: 0.
In 1.8.0-rc3, however, the results are
BenchmarkTools.Trial: 10000 samples with 1000 evaluations.
Range (min … max): 2.100 ns … 31.970 ns ┊ GC (min … max): 0.00% … 0.00%
Time (median): 2.120 ns ┊ GC (median): 0.00%
Time (mean ± σ): 2.130 ns ± 0.304 ns ┊ GC (mean ± σ): 0.00% ± 0.00%
▂ █
▂▁▁▁▁▁▁▁▁▁▁█▂▁▁▁▁▁▁▁▁▁▁█▂▁▁▁▁▁▁▁▁▁▇▂▁▁▁▁▁▁▁▁▁▁▃▁▁▁▁▁▁▁▁▁▁▆ ▂
2.1 ns Histogram: frequency by time 2.15 ns <
Memory estimate: 0 bytes, allocs estimate: 0.
There is also a difference in a = rand(Int64); b = rand(Int64); @code_native a + b
, with 1.7.2 returning
.text
; ┌ @ int.jl:87 within `+`
leaq (%rdi,%rsi), %rax
retq
nopw %cs:(%rax,%rax)
nop
; └
and 1.8.0-rc3 returning
.text
.file "+"
.globl "julia_+_763" # -- Begin function julia_+_763
.p2align 4, 0x90
.type "julia_+_763",@function
"julia_+_763": # @"julia_+_763"
; ┌ @ int.jl:87 within `+`
.cfi_startproc
# %bb.0: # %top
leaq (%rdi,%rsi), %rax
retq
.Lfunc_end0:
.size "julia_+_763", .Lfunc_end0-"julia_+_763"
.cfi_endproc
; └
# -- End function
.section ".note.GNU-stack","",@progbits
Why is this?
In case it’s helpful, here are both versioninfo
’s
Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: AMD Ryzen 7 2700X Eight-Core Processor
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, znver1)
Julia Version 1.8.0-rc3
Commit 33f19bcbd25 (2022-07-13 19:10 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 16 × AMD Ryzen 7 2700X Eight-Core Processor
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, znver1)
Threads: 1 on 16 virtual cores
I’m noticing the different LLVM version; is that it?