Are you launching Julia with -O3
?
Btw. this is what I get on my MacBook (i5):
░ tamasgal@greybox.local:~/tmp
░ 11:05:49 1 > g++ -O3 heap.cpp && ./a.out
Done in 825
░ tamasgal@greybox.local:~/tmp
░ 11:05:56 > julia -O3 heap.jl
ndrsh
824.606 ms (2 allocations: 38.15 MiB)
oscar
920.897 ms (2 allocations: 38.15 MiB)
and on my workhorse (Intel(R) Xeon(R) Gold 6246R CPU @ 3.40GHz - 32 cores):
tgal@pi1080:~/tmp/binary-heap-benchmark/cpp$ g++ -O3 heap.cpp && ./a.out
Done in 526
tgal@pi1080:~/tmp/binary-heap-benchmark/cpp$ cd ../julia/
tgal@pi1080:~/tmp/binary-heap-benchmark/julia$ julia -O3 heap.jl
ndrsh
595.149 ms (2 allocations: 38.15 MiB)
oscar
586.633 ms (2 allocations: 38.15 MiB)