Zig VS Julia benchmarks

Current benchmark data was generated on Thu Sep 22 2022, 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.)

binarytrees

Input: 18

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 4.jl 1155ms 55ms 258.8MB 1073ms 157ms julia 1.8.1
zig 1.zig 2143ms 29ms 49.2MB 2117ms 10ms zig 0.10.0-dev.4060+61aaef0b0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 178ms 0.4ms 7.1MB 160ms 0ms zig 0.10.0-dev.4060+61aaef0b0
julia 4.jl 307ms 1.6ms 240.5MB 250ms 133ms julia 1.8.1

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 3835ms 5.0ms 2.7MB 3793ms 20ms zig 0.10.0-dev.4060+61aaef0b0

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 637ms 0.2ms 2.1MB 613ms 7ms zig 0.10.0-dev.4060+61aaef0b0

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2-m.zig 1337ms 9.6ms 0.6MB 2607ms 0ms zig 0.10.0-dev.4060+61aaef0b0
zig 3-i.zig 1541ms 1.6ms 0.6MB 1530ms 0ms zig 0.10.0-dev.4060+61aaef0b0
julia 2-m.jl 1825ms 22ms 230.2MB 3183ms 130ms julia 1.8.1
zig 2.zig 2458ms 0.5ms 0.6MB 2447ms 0ms zig 0.10.0-dev.4060+61aaef0b0
zig 1.zig 3438ms 7.2ms 0.6MB 3427ms 0ms zig 0.10.0-dev.4060+61aaef0b0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2-m.zig 126ms 2.8ms 0.7MB 220ms 0ms zig 0.10.0-dev.4060+61aaef0b0
zig 3-i.zig 133ms 3.3ms 0.6MB 120ms 0ms zig 0.10.0-dev.4060+61aaef0b0
zig 2.zig 208ms 0.4ms 0.6MB 200ms 0ms zig 0.10.0-dev.4060+61aaef0b0
zig 1.zig 287ms 0.4ms 0.6MB 280ms 0ms zig 0.10.0-dev.4060+61aaef0b0
julia 2-m.jl 555ms 1.4ms 230.5MB 700ms 133ms julia 1.8.1

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 155ms 0.5ms 0.6MB 147ms 0ms zig 0.10.0-dev.4060+61aaef0b0
julia 7-m.jl 636ms 1.4ms 299.2MB 890ms 133ms julia 1.8.1

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 18ms 0.7ms 0.6MB 10ms 0ms zig 0.10.0-dev.4060+61aaef0b0
julia 7.jl 460ms 1.4ms 228.1MB 557ms 113ms julia 1.8.1

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 2.3ms 0.6ms 0.6MB 0ms 0ms zig 0.10.0-dev.4060+61aaef0b0
julia 1.jl 197ms 0.7ms 187.2MB 124ms 86ms julia 1.8.1
julia 1.jl 205ms 48ms 178.5MB 114ms 86ms julia/aot 1.8.1

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 126ms 0.5ms 12.0MB 113ms 0ms zig 0.10.0-dev.4060+61aaef0b0

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 769ms 0.5ms 80.6MB 723ms 30ms zig 0.10.0-dev.4060+61aaef0b0

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 8.jl 1162ms 1.6ms 318.3MB 1493ms 167ms julia 1.8.1
zig 1.zig 1294ms 6.2ms 21.7MB 1267ms 10ms zig 0.10.0-dev.4060+61aaef0b0

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 142ms 2.0ms 9.1MB 127ms 3ms zig 0.10.0-dev.4060+61aaef0b0
julia 8.jl 817ms 3.9ms 303.8MB 927ms 123ms julia 1.8.1

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 46ms 0.9ms 2.8MB 33ms 0ms zig 0.10.0-dev.4060+61aaef0b0

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 132ms 5.1ms 2.7MB 120ms 0ms zig 0.10.0-dev.4060+61aaef0b0

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 21ms 0.8ms 1.5MB 10ms 0ms zig 0.10.0-dev.4060+61aaef0b0

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 423ms 0.3ms 4.2MB 410ms 0ms zig 0.10.0-dev.4060+61aaef0b0

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 20ms 0.6ms 1.4MB 10ms 0ms zig 0.10.0-dev.4060+61aaef0b0

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 1098ms 74ms 41.1MB 1073ms 10ms zig 0.10.0-dev.4060+61aaef0b0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 211ms 0.3ms 11.3MB 197ms 0ms zig 0.10.0-dev.4060+61aaef0b0

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2.zig 302ms 0.8ms 0.6MB 290ms 0ms zig 0.10.0-dev.4060+61aaef0b0
zig 1.zig 367ms 2.3ms 0.6MB 357ms 0ms zig 0.10.0-dev.4060+61aaef0b0
julia 7.jl 554ms 1.2ms 180.3MB 510ms 120ms julia/aot 1.8.1
julia 7.jl 715ms 1.2ms 245.9MB 680ms 110ms julia 1.8.1

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2.zig 32ms 0.2ms 0.6MB 20ms 0ms zig 0.10.0-dev.4060+61aaef0b0
zig 1.zig 42ms 5.2ms 0.6MB 33ms 0ms zig 0.10.0-dev.4060+61aaef0b0
julia 7.jl 285ms 60ms 182.1MB 203ms 127ms julia/aot 1.8.1
julia 7.jl 405ms 0.7ms 245.8MB 343ms 143ms julia 1.8.1

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2.zig 419ms 0.8ms 6.0MB 410ms 0ms zig 0.10.0-dev.4060+61aaef0b0
julia 1.jl 427ms 1.7ms 175.5MB 410ms 97ms julia/aot 1.8.1
julia 1.jl 538ms 1.0ms 220.4MB 510ms 110ms julia 1.8.1

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2.zig 95ms 0.9ms 2.6MB 87ms 0ms zig 0.10.0-dev.4060+61aaef0b0
julia 1.jl 239ms 30ms 169.1MB 187ms 87ms julia/aot 1.8.1
julia 1.jl 336ms 1.0ms 211.2MB 310ms 107ms julia 1.8.1

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 3.jl 793ms 3.9ms 196.0MB 767ms 100ms julia 1.8.1
julia 1.jl 1425ms 3.7ms 276.0MB 1337ms 170ms julia 1.8.1
zig 1.zig 2205ms 6.2ms 2.3MB 2177ms 10ms zig 0.10.0-dev.4060+61aaef0b0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 3.jl 349ms 1.4ms 193.8MB 310ms 120ms julia 1.8.1
zig 1.zig 497ms 1.0ms 1.9MB 483ms 0ms zig 0.10.0-dev.4060+61aaef0b0
julia 1.jl 801ms 26ms 277.4MB 707ms 157ms julia 1.8.1

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2-m.zig 1073ms 15ms 1.8MB 2057ms 0ms zig 0.10.0-dev.4060+61aaef0b0
julia 2-m.jl 1373ms 2.1ms 205.1MB 2407ms 117ms julia 1.8.1
zig 2.zig 2061ms 0.6ms 0.6MB 2050ms 0ms zig 0.10.0-dev.4060+61aaef0b0
julia 3-m.jl 2069ms 3.9ms 220.3MB 3703ms 130ms julia 1.8.1
zig 1.zig 4579ms 4.9ms 1.6MB 4560ms 0ms zig 0.10.0-dev.4060+61aaef0b0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2-m.zig 277ms 1.7ms 0.8MB 507ms 0ms zig 0.10.0-dev.4060+61aaef0b0
zig 2.zig 517ms 0.6ms 0.6MB 503ms 0ms zig 0.10.0-dev.4060+61aaef0b0
julia 2-m.jl 582ms 1.2ms 206.8MB 873ms 103ms julia 1.8.1
julia 3-m.jl 795ms 4.6ms 219.1MB 1213ms 120ms julia 1.8.1
zig 1.zig 1146ms 0.7ms 0.6MB 1140ms 0ms zig 0.10.0-dev.4060+61aaef0b0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2-m.zig 76ms 0.7ms 0.8MB 120ms 0ms zig 0.10.0-dev.4060+61aaef0b0
zig 2.zig 131ms 0.3ms 0.6MB 120ms 0ms zig 0.10.0-dev.4060+61aaef0b0
zig 1.zig 289ms 0.3ms 0.6MB 280ms 0ms zig 0.10.0-dev.4060+61aaef0b0
julia 2-m.jl 385ms 1.0ms 204.8MB 477ms 107ms julia 1.8.1
julia 3.jl 476ms 2.8ms 220.2MB 580ms 130ms julia 1.8.1