Julia VS C++ benchmarks

Current benchmark data was generated on Sun Jan 29 2023, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][2 cores] Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz (Model 106)

* -m in a file name stands for multi-threading or multi-processing

* -i in a file name stands for direct intrinsics usage. (Usage of simd intrinsics via libraries is not counted)

* -ffi in a file name stands for non-stdlib FFI usage

* (You may find time < time(user) + time(sys) for some non-parallelized programs, the overhead is from GC or JIT compiler, which are allowed to take advantage of multi-cores as that's more close to real-world scenarios.)

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 1.cpp 1.7ms 0.4ms 1.3MB 0ms 0ms g++ 12.2.0
cpp 1.cpp 1.9ms 0.6ms 1.4MB 0ms 0ms clang++ 14.0.0
julia 1.jl 179ms 0.4ms 163.9MB 114ms 70ms julia/aot 1.8.5
julia 1.jl 194ms 1.8ms 171.2MB 132ms 76ms julia 1.8.5

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 0-i.cpp 225ms 0.6ms 1.3MB 210ms 0ms g++ 12.2.0
cpp 0-i.cpp 253ms 0.3ms 1.4MB 240ms 0ms clang++ 14.0.0
cpp 1.cpp 327ms 1.4ms 1.4MB 313ms 0ms clang++ 14.0.0
cpp 1.cpp 341ms 0.6ms 1.3MB 330ms 0ms g++ 12.2.0
julia 7.jl 549ms 0.1ms 168.6MB 507ms 120ms julia/aot 1.8.5
julia 7.jl 709ms 1.2ms 224.5MB 663ms 120ms julia 1.8.5

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 0-i.cpp 25ms 0.7ms 1.3MB 13ms 0ms g++ 12.2.0
cpp 0-i.cpp 28ms 0.5ms 1.4MB 20ms 0ms clang++ 14.0.0
cpp 1.cpp 35ms 0.3ms 1.4MB 23ms 0ms clang++ 14.0.0
cpp 1.cpp 38ms 2.9ms 1.3MB 30ms 0ms g++ 12.2.0
julia 7.jl 246ms 3.3ms 169.8MB 210ms 100ms julia/aot 1.8.5
julia 7.jl 395ms 6.8ms 223.7MB 333ms 133ms julia 1.8.5

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 1.jl 423ms 0.6ms 156.3MB 390ms 113ms julia/aot 1.8.5
julia 1.jl 528ms 2.4ms 203.3MB 487ms 113ms julia 1.8.5
cpp 1.cpp 641ms 0.7ms 7.6MB 627ms 0ms g++ 12.2.0
cpp 1.cpp 707ms 2.2ms 7.5MB 697ms 0ms clang++ 14.0.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 1.cpp 153ms 0.2ms 3.9MB 140ms 0ms g++ 12.2.0
cpp 1.cpp 170ms 1.3ms 3.9MB 160ms 0ms clang++ 14.0.0
julia 1.jl 220ms 2.5ms 150.2MB 177ms 87ms julia/aot 1.8.5
julia 1.jl 326ms 1.7ms 195.1MB 293ms 113ms julia 1.8.5

binarytrees

Input: 18

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 4.jl 1112ms 26ms 239.5MB 1023ms 163ms julia 1.8.5

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 4.jl 304ms 1.4ms 221.2MB 263ms 120ms julia 1.8.5

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 1-im.cpp 757ms 6.8ms 1.3MB 1457ms 0ms g++ 12.2.0
cpp 1-im.cpp 770ms 13ms 3.9MB 1493ms 0ms clang++ 14.0.0
julia 2-m.jl 1775ms 12ms 210.1MB 3120ms 127ms julia 1.8.5

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 1-im.cpp 71ms 0.7ms 1.3MB 120ms 0ms g++ 12.2.0
cpp 1-im.cpp 72ms 0.8ms 5.9MB 123ms 0ms clang++ 14.0.0
julia 2-m.jl 527ms 5.9ms 209.8MB 693ms 117ms julia 1.8.5

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 7-m.jl 630ms 2.1ms 291.8MB 860ms 147ms julia 1.8.5

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 7-m.jl 451ms 0.5ms 226.0MB 563ms 117ms julia 1.8.5

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 8.jl 1118ms 9.1ms 273.3MB 1470ms 157ms julia 1.8.5

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 8.jl 763ms 4.0ms 259.1MB 847ms 143ms julia 1.8.5

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 3.jl 791ms 4.6ms 176.9MB 760ms 103ms julia 1.8.5
julia 1.jl 1373ms 3.2ms 260.8MB 1303ms 147ms julia 1.8.5

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 3.jl 342ms 0.3ms 176.2MB 307ms 113ms julia 1.8.5
julia 1.jl 780ms 23ms 261.5MB 710ms 133ms julia 1.8.5

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 8-m.cpp 1059ms 1.1ms 3.3MB 2070ms 3ms clang++ 14.0.0
cpp 7-m.cpp 1063ms 0.2ms 3.4MB 2077ms 0ms clang++ 14.0.0
cpp 7-m.cpp 1064ms 4.4ms 1.4MB 2083ms 0ms g++ 12.2.0
cpp 8-m.cpp 1066ms 1.8ms 1.3MB 2083ms 0ms g++ 12.2.0
julia 2-m.jl 1370ms 7.3ms 192.9MB 2410ms 103ms julia 1.8.5
julia 3-m.jl 2107ms 0.8ms 211.4MB 3787ms 123ms julia 1.8.5
cpp 6-im.cpp 2222ms 12ms 3.3MB 4360ms 3ms clang++ 14.0.0
cpp 6-im.cpp 2236ms 14ms 1.3MB 4390ms 3ms g++ 12.2.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 8-m.cpp 275ms 0.8ms 1.3MB 520ms 0ms g++ 12.2.0
cpp 8-m.cpp 275ms 1.2ms 3.3MB 517ms 0ms clang++ 14.0.0
cpp 7-m.cpp 276ms 1.6ms 3.3MB 520ms 0ms clang++ 14.0.0
cpp 7-m.cpp 276ms 1.2ms 1.4MB 520ms 0ms g++ 12.2.0
cpp 6-im.cpp 565ms 2.3ms 1.3MB 1087ms 0ms g++ 12.2.0
cpp 6-im.cpp 574ms 22ms 3.3MB 1100ms 0ms clang++ 14.0.0
julia 2-m.jl 578ms 0.1ms 192.5MB 853ms 110ms julia 1.8.5
julia 3-m.jl 804ms 1.2ms 210.3MB 1233ms 120ms julia 1.8.5

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 7-m.cpp 76ms 1.3ms 3.3MB 130ms 0ms clang++ 14.0.0
cpp 7-m.cpp 77ms 1.8ms 1.4MB 130ms 0ms g++ 12.2.0
cpp 8-m.cpp 77ms 1.6ms 3.3MB 130ms 0ms clang++ 14.0.0
cpp 8-m.cpp 79ms 2.0ms 1.4MB 130ms 0ms g++ 12.2.0
cpp 6-im.cpp 150ms 2.7ms 3.4MB 273ms 0ms clang++ 14.0.0
cpp 6-im.cpp 150ms 1.0ms 1.3MB 273ms 0ms g++ 12.2.0
julia 2-m.jl 381ms 2.7ms 192.3MB 467ms 113ms julia 1.8.5
julia 3.jl 477ms 5.1ms 211.5MB 577ms 137ms julia 1.8.5