Kotlin VS Haxe 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
kotlin 1.kt 793ms 13ms 413.5MB 770ms 157ms kotlin/jvm 17.0.2
haxe 1.hx 2201ms 42ms 146.2MB 2680ms 83ms haxe/cpp 4.2.5
haxe 2.hx timeout 0.0ms 400.3MB 6437ms 250ms haxe/cpp 4.2.5
haxe 1.hx timeout 0.0ms 48.6MB 4717ms 263ms haxe/hl/c 4.2.5
haxe 2.hx timeout 0.0ms 83.0MB 4470ms 507ms haxe/hl/c 4.2.5
haxe 1.hx timeout 0.0ms 49.0MB 4710ms 267ms haxe/hl/jit 1.13.0
haxe 2.hx timeout 0.0ms 130.2MB 4537ms 447ms haxe/hl/jit 1.13.0
kotlin 1.kt timeout 0.0ms 194.4MB 8290ms 1107ms kotlin/native 1.8.10

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 153ms 9.8ms 27.6MB 140ms 17ms haxe/cpp 4.2.5
kotlin 1.kt 155ms 4.2ms 109.3MB 123ms 43ms kotlin/jvm 17.0.2
haxe 2.hx 587ms 11ms 60.3MB 693ms 37ms haxe/cpp 4.2.5
kotlin 1-m.kt 657ms 26ms 34.4MB 1093ms 130ms kotlin/native 1.8.10
haxe 1.hx 1017ms 21ms 8.6MB 963ms 33ms haxe/hl/c 4.2.5
haxe 1.hx 1220ms 18ms 11.1MB 1147ms 53ms haxe/hl/jit 1.13.0
haxe 2.hx 1565ms 20ms 13.4MB 1423ms 123ms haxe/hl/c 4.2.5
haxe 2.hx 1987ms 8.3ms 25.0MB 1800ms 173ms haxe/hl/jit 1.13.0

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 2-m.kt 3597ms 413ms 161.1MB 6813ms 113ms kotlin/jvm 17.0.2
kotlin 1.kt 3783ms 53ms 155.5MB 4727ms 100ms kotlin/jvm 17.0.2
kotlin 1.kt timeout 0.0ms 10.8MB 6150ms 310ms kotlin/native 1.8.10
kotlin 2-m.kt timeout 0.0ms 35.5MB 9297ms 157ms kotlin/native 1.8.10

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1-m.kt 826ms 21ms 94.0MB 1427ms 67ms kotlin/jvm 17.0.2
kotlin 2-m.kt 1125ms 20ms 19.5MB 2007ms 60ms kotlin/native 1.8.10
kotlin 2-m.kt 1200ms 149ms 106.7MB 2163ms 60ms kotlin/jvm 17.0.2
kotlin 1.kt 1335ms 37ms 8.9MB 1620ms 73ms kotlin/native 1.8.10

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 2.6ms 0.4ms 1.5MB 0ms 0ms kotlin/native 1.8.10
haxe 1.hx 3.7ms 0.5ms 2.3MB 0ms 0ms haxe/hl/c 4.2.5
haxe 1.hx 4.3ms 1.1ms 3.2MB 0ms 0ms haxe/cpp 4.2.5
haxe 1.hx 5.0ms 0.5ms 3.2MB 0ms 0ms haxe/hl/jit 1.13.0
kotlin 1.kt 78ms 1.3ms 40.7MB 62ms 10ms kotlin/jvm 17.0.2

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt timeout 0.0ms 239.0MB 8937ms 550ms kotlin/jvm 17.0.2
kotlin 2.kt timeout 0.0ms 290.5MB 8860ms 547ms kotlin/jvm 17.0.2

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 2.kt 2885ms 302ms 195.7MB 3507ms 273ms kotlin/jvm 17.0.2
kotlin 1-m.kt 3422ms 196ms 183.7MB 5610ms 430ms kotlin/jvm 17.0.2

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1-m.kt 1346ms 36ms 211.9MB 2263ms 103ms kotlin/jvm 17.0.2

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt timeout 0.0ms 890.0MB 7643ms 330ms kotlin/jvm 17.0.2

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 224ms 2.2ms 22.4MB 200ms 13ms haxe/cpp 4.2.5
haxe 1.hx 243ms 4.7ms 2.9MB 227ms 0ms haxe/hl/c 4.2.5
haxe 1.hx 277ms 5.8ms 3.7MB 263ms 0ms haxe/hl/jit 1.13.0
kotlin 2-m.kt 300ms 6.2ms 113.5MB 417ms 47ms kotlin/jvm 17.0.2
kotlin 1.kt 303ms 5.8ms 109.7MB 373ms 30ms kotlin/jvm 17.0.2
kotlin 2-m.kt 531ms 3.3ms 42.3MB 777ms 33ms kotlin/native 1.8.10
kotlin 1.kt timeout 0.0ms 15.0MB 5003ms 7ms kotlin/native 1.8.10

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 2.kt 497ms 17ms 130.5MB 600ms 57ms kotlin/jvm 17.0.2
kotlin 1.kt 592ms 9.7ms 132.2MB 643ms 43ms kotlin/jvm 17.0.2
haxe 1.hx 642ms 8.7ms 27.4MB 623ms 13ms haxe/cpp 4.2.5
haxe 1.hx 722ms 15ms 2.8MB 707ms 0ms haxe/hl/c 4.2.5
haxe 1.hx 811ms 15ms 3.7MB 793ms 0ms haxe/hl/jit 1.13.0
kotlin 2-m.kt 1648ms 11ms 114.0MB 2420ms 93ms kotlin/native 1.8.10
kotlin 1.kt timeout 0.0ms 15.0MB 4997ms 10ms kotlin/native 1.8.10

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 106ms 0.7ms 14.2MB 87ms 3ms haxe/cpp 4.2.5
haxe 1.hx 121ms 2.5ms 2.9MB 110ms 0ms haxe/hl/c 4.2.5
haxe 1.hx 137ms 4.7ms 3.6MB 127ms 0ms haxe/hl/jit 1.13.0
kotlin 1.kt 220ms 4.7ms 77.2MB 297ms 30ms kotlin/jvm 17.0.2
kotlin 2-m.kt 221ms 14ms 78.5MB 307ms 40ms kotlin/jvm 17.0.2
kotlin 2-m.kt 264ms 5.1ms 32.3MB 410ms 20ms kotlin/native 1.8.10
kotlin 1.kt timeout 0.0ms 17.1MB 4997ms 13ms kotlin/native 1.8.10

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 580ms 1.6ms 363.2MB 553ms 110ms kotlin/jvm 17.0.2
haxe 1.hx 1517ms 33ms 97.1MB 1783ms 63ms haxe/cpp 4.2.5
kotlin 1-m.kt 3664ms 86ms 138.6MB 5797ms 787ms kotlin/native 1.8.10
haxe 1.hx timeout 0.0ms 32.7MB 4657ms 327ms haxe/hl/c 4.2.5
haxe 1.hx timeout 0.0ms 53.7MB 4637ms 347ms haxe/hl/jit 1.13.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 234ms 5.3ms 221.4MB 200ms 63ms kotlin/jvm 17.0.2
haxe 1.hx 303ms 9.8ms 28.7MB 303ms 13ms haxe/cpp 4.2.5
kotlin 1-m.kt 732ms 13ms 38.4MB 1173ms 133ms kotlin/native 1.8.10
haxe 1.hx 1964ms 16ms 10.9MB 1850ms 93ms haxe/hl/c 4.2.5
haxe 1.hx 2306ms 12ms 20.2MB 2133ms 157ms haxe/hl/jit 1.13.0

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 768ms 9.5ms 42.9MB 757ms 27ms kotlin/jvm 17.0.2
kotlin 1n.kt 837ms 45ms 1.5MB 827ms 0ms kotlin/native 1.8.10
haxe 2.hx 1304ms 23ms 2.3MB 1293ms 0ms haxe/hl/c 4.2.5
haxe 1.hx 1709ms 6.3ms 2.3MB 1697ms 0ms haxe/hl/c 4.2.5
haxe 3-m.hx 1780ms 28ms 27.6MB 2797ms 30ms haxe/cpp 4.2.5
haxe 2.hx 2981ms 49ms 3.3MB 2967ms 0ms haxe/hl/jit 1.13.0
haxe 1.hx 3144ms 83ms 3.2MB 3127ms 0ms haxe/hl/jit 1.13.0
haxe 1.hx timeout 0.0ms 3.3MB 4980ms 0ms haxe/cpp 4.2.5
haxe 2.hx timeout 0.0ms 3.2MB 4983ms 0ms haxe/cpp 4.2.5
haxe 3.hx timeout 0.0ms 3.3MB 4530ms 453ms haxe/hl/c 4.2.5
haxe 3.hx timeout 0.0ms 3.7MB 4647ms 330ms haxe/hl/jit 1.13.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1n.kt 88ms 3.6ms 1.5MB 80ms 0ms kotlin/native 1.8.10
haxe 2.hx 135ms 3.5ms 2.3MB 130ms 0ms haxe/hl/c 4.2.5
haxe 1.hx 180ms 8.2ms 2.3MB 170ms 0ms haxe/hl/c 4.2.5
kotlin 1.kt 185ms 11ms 43.0MB 183ms 20ms kotlin/jvm 17.0.2
haxe 3.hx 201ms 1.9ms 27.6MB 263ms 7ms haxe/cpp 4.2.5
haxe 2.hx 299ms 0.9ms 3.3MB 287ms 0ms haxe/hl/jit 1.13.0
haxe 1.hx 322ms 8.0ms 3.2MB 310ms 0ms haxe/hl/jit 1.13.0
haxe 3.hx 827ms 3.3ms 3.1MB 743ms 70ms haxe/hl/c 4.2.5
haxe 3.hx 976ms 3.7ms 3.6MB 893ms 63ms haxe/hl/jit 1.13.0
haxe 2.hx 1025ms 6.6ms 3.2MB 1013ms 0ms haxe/cpp 4.2.5
haxe 1.hx 1242ms 3.3ms 3.2MB 1227ms 0ms haxe/cpp 4.2.5

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt timeout 0.0ms 204.7MB 5390ms 100ms kotlin/jvm 17.0.2
kotlin 1n.kt timeout 0.0ms 14.9MB 6577ms 220ms kotlin/native 1.8.10
kotlin 2n.kt timeout 0.0ms 8.4MB 5067ms 107ms kotlin/native 1.8.10

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 1691ms 16ms 244.6MB 2053ms 87ms kotlin/jvm 17.0.2
kotlin 1n.kt timeout 0.0ms 22.9MB 6607ms 190ms kotlin/native 1.8.10
kotlin 2n.kt timeout 0.0ms 10.4MB 5077ms 100ms kotlin/native 1.8.10

regex-redux

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt timeout 0.0ms 161.4MB 5357ms 67ms kotlin/jvm 17.0.2
kotlin 1n.kt timeout 0.0ms 277.3MB 5270ms 943ms kotlin/native 1.8.10

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 1213ms 13ms 96.9MB 1667ms 37ms kotlin/jvm 17.0.2
kotlin 1n.kt timeout 0.0ms 65.1MB 6333ms 47ms kotlin/native 1.8.10

secp256k1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt timeout 0.0ms 182.5MB 5997ms 97ms kotlin/jvm 17.0.2

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1-m.kt 1604ms 20ms 182.9MB 2433ms 83ms kotlin/jvm 17.0.2