Zig VS Julia benchmarks

Current benchmark data was generated on Wed Feb 08 2023, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][2 cores] Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz (Model 85)

* -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 1444ms 14ms 241.6MB 1307ms 233ms julia 1.8.5
zig 1.zig 2850ms 12ms 49.1MB 2820ms 13ms zig 0.11.0-dev.1580+a5b34a61a

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 237ms 2.6ms 7.0MB 220ms 0ms zig 0.11.0-dev.1580+a5b34a61a
julia 4.jl 392ms 4.3ms 225.4MB 323ms 170ms julia 1.8.5

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig timeout 0.0ms 2.6MB 4983ms 0ms zig 0.11.0-dev.1580+a5b34a61a

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 975ms 29ms 2.0MB 950ms 7ms zig 0.11.0-dev.1580+a5b34a61a

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2-m.zig 1401ms 16ms 1.1MB 2713ms 0ms zig 0.11.0-dev.1580+a5b34a61a
zig 3-i.zig 1699ms 3.5ms 1.0MB 1687ms 0ms zig 0.11.0-dev.1580+a5b34a61a
julia 2-m.jl 1982ms 6.8ms 210.4MB 3410ms 180ms julia 1.8.5
zig 2.zig 2854ms 1.2ms 1.0MB 2843ms 0ms zig 0.11.0-dev.1580+a5b34a61a
zig 1.zig 3856ms 30ms 1.0MB 3847ms 0ms zig 0.11.0-dev.1580+a5b34a61a

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2-m.zig 134ms 1.0ms 1.1MB 233ms 0ms zig 0.11.0-dev.1580+a5b34a61a
zig 3-i.zig 145ms 0.7ms 1.0MB 130ms 0ms zig 0.11.0-dev.1580+a5b34a61a
zig 2.zig 242ms 0.2ms 1.0MB 230ms 0ms zig 0.11.0-dev.1580+a5b34a61a
zig 1.zig 323ms 0.7ms 1.0MB 310ms 0ms zig 0.11.0-dev.1580+a5b34a61a
julia 2-m.jl 674ms 29ms 211.1MB 830ms 190ms julia 1.8.5

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 165ms 2.4ms 1.0MB 153ms 0ms zig 0.11.0-dev.1580+a5b34a61a
julia 7-m.jl 797ms 8.6ms 298.9MB 1077ms 200ms julia 1.8.5

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 22ms 1.6ms 1.0MB 10ms 0ms zig 0.11.0-dev.1580+a5b34a61a
julia 7.jl 570ms 8.1ms 227.5MB 683ms 167ms julia 1.8.5

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 2.1ms 0.7ms 0.9MB 0ms 0ms zig 0.11.0-dev.1580+a5b34a61a
julia 1.jl 236ms 5.1ms 167.8MB 138ms 110ms julia/aot 1.8.5
julia 1.jl 250ms 5.6ms 171.5MB 152ms 114ms julia 1.8.5

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 144ms 5.5ms 14.4MB 123ms 7ms zig 0.11.0-dev.1580+a5b34a61a

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 866ms 46ms 75.0MB 810ms 40ms zig 0.11.0-dev.1580+a5b34a61a

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 1282ms 8.4ms 25.8MB 1240ms 27ms zig 0.11.0-dev.1580+a5b34a61a
julia 8.jl 1412ms 8.8ms 274.1MB 1860ms 193ms julia 1.8.5

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 144ms 1.9ms 7.5MB 127ms 0ms zig 0.11.0-dev.1580+a5b34a61a
julia 8.jl 950ms 17ms 262.9MB 1040ms 200ms julia 1.8.5

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 59ms 1.7ms 2.8MB 50ms 0ms zig 0.11.0-dev.1580+a5b34a61a

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 164ms 1.5ms 2.9MB 150ms 0ms zig 0.11.0-dev.1580+a5b34a61a

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 33ms 8.3ms 1.3MB 23ms 0ms zig 0.11.0-dev.1580+a5b34a61a

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 457ms 14ms 4.2MB 443ms 0ms zig 0.11.0-dev.1580+a5b34a61a

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 23ms 1.3ms 1.0MB 10ms 0ms zig 0.11.0-dev.1580+a5b34a61a

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 1335ms 3.4ms 41.1MB 1300ms 13ms zig 0.11.0-dev.1580+a5b34a61a

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 269ms 1.4ms 11.0MB 253ms 0ms zig 0.11.0-dev.1580+a5b34a61a

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2.zig 308ms 5.8ms 1.1MB 293ms 0ms zig 0.11.0-dev.1580+a5b34a61a
zig 1.zig 462ms 6.7ms 1.0MB 453ms 0ms zig 0.11.0-dev.1580+a5b34a61a
julia 7.jl 646ms 1.6ms 168.0MB 587ms 163ms julia/aot 1.8.5
julia 7.jl 833ms 13ms 225.8MB 763ms 180ms julia 1.8.5

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2.zig 35ms 0.6ms 1.0MB 27ms 0ms zig 0.11.0-dev.1580+a5b34a61a
zig 1.zig 50ms 1.5ms 1.0MB 40ms 0ms zig 0.11.0-dev.1580+a5b34a61a
julia 7.jl 317ms 22ms 167.0MB 240ms 147ms julia/aot 1.8.5
julia 7.jl 526ms 2.9ms 227.5MB 423ms 200ms julia 1.8.5

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2.zig 439ms 0.8ms 6.0MB 423ms 0ms zig 0.11.0-dev.1580+a5b34a61a
julia 1.jl 519ms 11ms 156.1MB 467ms 163ms julia/aot 1.8.5
julia 1.jl 636ms 7.2ms 203.7MB 587ms 150ms julia 1.8.5
zig 1.zig 943ms 42ms 40.1MB 917ms 10ms zig 0.11.0-dev.1580+a5b34a61a

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2.zig 97ms 2.8ms 2.1MB 87ms 0ms zig 0.11.0-dev.1580+a5b34a61a
zig 1.zig 128ms 1.0ms 10.9MB 110ms 0ms zig 0.11.0-dev.1580+a5b34a61a
julia 1.jl 301ms 26ms 149.8MB 190ms 150ms julia/aot 1.8.5
julia 1.jl 405ms 6.3ms 197.2MB 327ms 180ms julia 1.8.5

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 3.jl 856ms 22ms 178.0MB 807ms 157ms julia 1.8.5
julia 1.jl 1650ms 5.6ms 261.1MB 1530ms 227ms julia 1.8.5
zig 1.zig 2406ms 1.7ms 2.3MB 2373ms 13ms zig 0.11.0-dev.1580+a5b34a61a

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 3.jl 418ms 15ms 175.4MB 353ms 170ms julia 1.8.5
zig 1.zig 558ms 10ms 1.8MB 547ms 0ms zig 0.11.0-dev.1580+a5b34a61a
julia 1.jl 1002ms 43ms 261.2MB 880ms 207ms julia 1.8.5

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2-m.zig 1088ms 3.9ms 1.2MB 2083ms 0ms zig 0.11.0-dev.1580+a5b34a61a
julia 2-m.jl 1489ms 28ms 193.8MB 2493ms 173ms julia 1.8.5
zig 2.zig 2072ms 6.8ms 1.0MB 2063ms 0ms zig 0.11.0-dev.1580+a5b34a61a
julia 3-m.jl 2607ms 78ms 208.5MB 4643ms 157ms julia 1.8.5
zig 1.zig 4631ms 11ms 1.0MB 4617ms 0ms zig 0.11.0-dev.1580+a5b34a61a

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2-m.zig 284ms 2.0ms 1.2MB 510ms 0ms zig 0.11.0-dev.1580+a5b34a61a
zig 2.zig 525ms 10ms 1.0MB 513ms 0ms zig 0.11.0-dev.1580+a5b34a61a
julia 2-m.jl 682ms 15ms 194.1MB 940ms 170ms julia 1.8.5
julia 3-m.jl 1012ms 20ms 208.1MB 1503ms 173ms julia 1.8.5
zig 1.zig 1156ms 3.2ms 1.0MB 1143ms 0ms zig 0.11.0-dev.1580+a5b34a61a

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2-m.zig 79ms 1.5ms 1.1MB 127ms 0ms zig 0.11.0-dev.1580+a5b34a61a
zig 2.zig 136ms 2.1ms 1.6MB 127ms 0ms zig 0.11.0-dev.1580+a5b34a61a
zig 1.zig 294ms 0.5ms 1.0MB 280ms 0ms zig 0.11.0-dev.1580+a5b34a61a
julia 2.jl 473ms 2.6ms 195.0MB 543ms 163ms julia 1.8.5
julia 3.jl 600ms 8.7ms 208.4MB 713ms 183ms julia 1.8.5