C VS Haxe benchmarks

Current benchmark data was generated on Tue Mar 25 2025, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][4 cores] AMD EPYC 7763 64-Core Processor (Model 1)

* -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
c 1.c 1.0ms 0.0ms 1.4MB 0ms 0ms zigcc 0.14.0
c 1.c 1.2ms 0.1ms 2.1MB 0ms 0ms gcc 14.2.0
c 1.c 1.3ms 0.1ms 2.1MB 0ms 0ms clang 14.0.0-1ubuntu1.1
haxe 1.hx 2.0ms 0.3ms 2.9MB 0ms 0ms haxe/hl/c 4.3.6
haxe 1.hx 2.5ms 0.2ms 4.5MB 0ms 0ms haxe/cpp 4.3.6
haxe 1.hx 3.6ms 0.3ms 2.9MB 0ms 0ms haxe/hl/jit 1.15.0

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 1-m.c 178ms 4.6ms 22.8MB 420ms 3ms gcc 14.2.0
c 1-m.c 317ms 51ms 25.9MB 1090ms 27ms clang 14.0.0-1ubuntu1.1

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 1-m.c 28ms 1.6ms 13.9MB 63ms 0ms gcc 14.2.0
c 1-m.c 36ms 0.8ms 15.1MB 100ms 3ms clang 14.0.0-1ubuntu1.1

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 1-mffi.c 222ms 13ms 7.6MB 827ms 10ms clang 14.0.0-1ubuntu1.1
c 1-mffi.c 265ms 2.3ms 6.7MB 810ms 0ms gcc 14.2.0
c 1-mffi.c 332ms 2.1ms 5.9MB 320ms 0ms zigcc 0.14.0
c 1-ffi.c 332ms 2.5ms 5.9MB 323ms 0ms zigcc 0.14.0
c 1-ffi.c 456ms 4.1ms 6.4MB 443ms 0ms clang 14.0.0-1ubuntu1.1
c 1-ffi.c 541ms 2.5ms 6.7MB 530ms 0ms gcc 14.2.0

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 1-ffi.c 16ms 0.1ms 3.0MB 10ms 0ms zigcc 0.14.0
c 1-mffi.c 16ms 0.1ms 3.0MB 10ms 0ms zigcc 0.14.0
c 1-mffi.c 18ms 1.7ms 3.8MB 43ms 0ms gcc 14.2.0
c 1-mffi.c 18ms 1.6ms 4.6MB 30ms 0ms clang 14.0.0-1ubuntu1.1
c 1-ffi.c 22ms 0.1ms 3.6MB 10ms 0ms clang 14.0.0-1ubuntu1.1
c 1-ffi.c 26ms 1.0ms 3.8MB 20ms 0ms gcc 14.2.0

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 8-i.c 270ms 3.5ms 1.5MB 263ms 0ms zigcc 0.14.0
c 8-i.c 303ms 0.8ms 2.1MB 290ms 0ms clang 14.0.0-1ubuntu1.1
c 2.c 310ms 0.8ms 2.3MB 300ms 0ms gcc 14.2.0
c 5.c 313ms 0.8ms 2.3MB 307ms 0ms gcc 14.2.0
c 5.c 317ms 0.3ms 2.1MB 310ms 0ms clang 14.0.0-1ubuntu1.1
c 2.c 317ms 5.6ms 1.5MB 303ms 0ms zigcc 0.14.0
c 5.c 318ms 3.5ms 1.5MB 310ms 0ms zigcc 0.14.0
c 2.c 318ms 2.2ms 2.1MB 310ms 0ms clang 14.0.0-1ubuntu1.1
c 8-i.c 333ms 0.4ms 2.3MB 320ms 0ms gcc 14.2.0
haxe 2.hx 854ms 0.2ms 3.0MB 843ms 0ms haxe/hl/c 4.3.6
haxe 1.hx 1074ms 5.4ms 3.0MB 1063ms 0ms haxe/hl/c 4.3.6
haxe 3.hx 1406ms 6.4ms 25.6MB 1630ms 37ms haxe/cpp 4.3.6
haxe 2.hx 2407ms 2.7ms 3.6MB 2397ms 0ms haxe/hl/jit 1.15.0
haxe 1.hx 2472ms 1.5ms 3.6MB 2460ms 0ms haxe/hl/jit 1.15.0
haxe 1.hx timeout 0.0ms 4.4MB 4990ms 0ms haxe/cpp 4.3.6
haxe 2.hx timeout 0.0ms 4.4MB 4990ms 0ms haxe/cpp 4.3.6
haxe 3.hx timeout 0.0ms 3.3MB 3970ms 1537ms haxe/hl/c 4.3.6
haxe 3.hx timeout 0.0ms 3.8MB 4167ms 1297ms haxe/hl/jit 1.15.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 8-i.c 31ms 4.1ms 1.5MB 23ms 0ms zigcc 0.14.0
c 8-i.c 34ms 0.5ms 2.3MB 27ms 0ms clang 14.0.0-1ubuntu1.1
c 2.c 34ms 0.5ms 2.3MB 30ms 0ms gcc 14.2.0
c 2.c 34ms 0.3ms 1.5MB 30ms 0ms zigcc 0.14.0
c 5.c 34ms 0.1ms 2.3MB 30ms 0ms clang 14.0.0-1ubuntu1.1
c 5.c 34ms 0.3ms 2.3MB 30ms 0ms gcc 14.2.0
c 5.c 35ms 0.6ms 1.5MB 30ms 0ms zigcc 0.14.0
c 8-i.c 36ms 0.2ms 2.3MB 30ms 0ms gcc 14.2.0
c 2.c 40ms 2.3ms 2.1MB 30ms 0ms clang 14.0.0-1ubuntu1.1
haxe 2.hx 90ms 0.8ms 3.0MB 80ms 0ms haxe/hl/c 4.3.6
haxe 1.hx 113ms 3.1ms 3.0MB 103ms 0ms haxe/hl/c 4.3.6
haxe 3.hx 156ms 1.6ms 25.6MB 163ms 10ms haxe/cpp 4.3.6
haxe 2.hx 248ms 0.6ms 3.6MB 240ms 0ms haxe/hl/jit 1.15.0
haxe 1.hx 253ms 1.7ms 3.6MB 240ms 0ms haxe/hl/jit 1.15.0
haxe 2.hx 675ms 4.9ms 4.4MB 667ms 0ms haxe/cpp 4.3.6
haxe 3.hx 678ms 1.9ms 3.1MB 530ms 210ms haxe/hl/c 4.3.6
haxe 3.hx 790ms 3.6ms 4.0MB 663ms 187ms haxe/hl/jit 1.15.0
haxe 1.hx 811ms 2.4ms 4.4MB 800ms 0ms haxe/cpp 4.3.6

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 1.c 292ms 7.4ms 41.0MB 277ms 0ms gcc 14.2.0
c 1.c 327ms 8.1ms 40.2MB 310ms 0ms zigcc 0.14.0
c 1.c 337ms 20ms 40.8MB 317ms 0ms clang 14.0.0-1ubuntu1.1

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 1.c 53ms 4.6ms 11.8MB 43ms 0ms gcc 14.2.0
c 1.c 55ms 2.0ms 11.6MB 43ms 0ms clang 14.0.0-1ubuntu1.1
c 1.c 60ms 1.3ms 11.0MB 50ms 0ms zigcc 0.14.0

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 6-im.c 958ms 2.2ms 2.0MB 3770ms 0ms gcc 14.2.0
c 4-m.c 968ms 2.7ms 2.0MB 3810ms 0ms gcc 14.2.0
c 6-im.c 1011ms 12ms 3.3MB 3953ms 7ms clang 14.0.0-1ubuntu1.1
c 5-im.c 1099ms 17ms 2.0MB 4293ms 3ms gcc 14.2.0
c 4-m.c 1132ms 16ms 3.1MB 4430ms 7ms clang 14.0.0-1ubuntu1.1
c 5-im.c 1333ms 5.5ms 3.3MB 5243ms 3ms clang 14.0.0-1ubuntu1.1
c 3-m.c 1845ms 24ms 3.3MB 7243ms 10ms clang 14.0.0-1ubuntu1.1
c 3-m.c 1975ms 10ms 2.3MB 7780ms 7ms gcc 14.2.0
haxe 1.hx 3940ms 1.3ms 3.3MB 3927ms 0ms haxe/hl/c 4.3.6
haxe 1.hx timeout 0.0ms 7.0MB 4990ms 0ms haxe/cpp 4.3.6
haxe 1.hx timeout 0.0ms 3.9MB 4990ms 0ms haxe/hl/jit 1.15.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 6-im.c 247ms 0.9ms 2.0MB 943ms 0ms gcc 14.2.0
c 4-m.c 252ms 1.3ms 2.1MB 967ms 0ms gcc 14.2.0
c 6-im.c 263ms 2.8ms 3.3MB 993ms 0ms clang 14.0.0-1ubuntu1.1
c 5-im.c 287ms 8.2ms 2.0MB 1100ms 0ms gcc 14.2.0
c 4-m.c 289ms 1.7ms 3.3MB 1110ms 0ms clang 14.0.0-1ubuntu1.1
c 5-im.c 342ms 1.1ms 3.3MB 1313ms 0ms clang 14.0.0-1ubuntu1.1
c 3-m.c 496ms 43ms 3.3MB 1873ms 7ms clang 14.0.0-1ubuntu1.1
c 3-m.c 497ms 0.9ms 2.0MB 1940ms 0ms gcc 14.2.0
haxe 1.hx 1002ms 14ms 3.2MB 990ms 0ms haxe/hl/c 4.3.6
haxe 1.hx 2399ms 0.3ms 6.5MB 2390ms 0ms haxe/cpp 4.3.6
haxe 1.hx timeout 0.0ms 3.9MB 4990ms 0ms haxe/hl/jit 1.15.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 4-m.c 71ms 0.4ms 2.0MB 257ms 0ms gcc 14.2.0
c 6-im.c 73ms 4.0ms 3.3MB 253ms 0ms clang 14.0.0-1ubuntu1.1
c 6-im.c 75ms 7.5ms 2.0MB 263ms 0ms gcc 14.2.0
c 5-im.c 79ms 1.5ms 2.0MB 280ms 0ms gcc 14.2.0
c 4-m.c 79ms 0.8ms 3.1MB 280ms 0ms clang 14.0.0-1ubuntu1.1
c 5-im.c 92ms 1.5ms 3.1MB 327ms 0ms clang 14.0.0-1ubuntu1.1
c 3-m.c 126ms 3.1ms 3.1MB 453ms 0ms clang 14.0.0-1ubuntu1.1
c 3-m.c 131ms 1.1ms 2.0MB 493ms 0ms gcc 14.2.0
haxe 1.hx 254ms 3.0ms 3.2MB 243ms 0ms haxe/hl/c 4.3.6
haxe 1.hx 603ms 0.6ms 5.3MB 590ms 0ms haxe/cpp 4.3.6
haxe 1.hx 2314ms 14ms 3.8MB 2303ms 0ms haxe/hl/jit 1.15.0