Kotlin VS Wasm 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
wasm 3.rs 2706ms 17ms 48.1MB 2673ms 17ms wasmedgec 0.11.2
wasm 5.rs 2707ms 6.6ms 31.2MB 2683ms 3ms wasmedgec 0.11.2
wasm 4.rs 2873ms 6.5ms 31.7MB 2840ms 13ms wasmedgec 0.11.2
wasm 5.rs 3216ms 6.5ms 59.3MB 3213ms 20ms node 16.19.0
wasm 3.rs 3302ms 25ms 74.9MB 3267ms 27ms node 16.19.0
wasm 4.rs 3315ms 8.3ms 59.7MB 3310ms 23ms node 16.19.0
wasm 5.rs 3364ms 1.0ms 26.9MB 3343ms 7ms wasmtime 5.0.0
wasm 4.rs 3507ms 18ms 26.8MB 3480ms 10ms wasmtime 5.0.0
wasm 3.rs 3669ms 17ms 42.5MB 3647ms 3ms wasmtime 5.0.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
kotlin 1.kt 155ms 4.2ms 109.3MB 123ms 43ms kotlin/jvm 17.0.2
wasm 3.rs 247ms 1.1ms 19.0MB 240ms 0ms wasmedgec 0.11.2
wasm 5.rs 260ms 3.4ms 18.7MB 243ms 0ms wasmedgec 0.11.2
wasm 4.rs 275ms 4.6ms 17.0MB 260ms 0ms wasmedgec 0.11.2
wasm 5.rs 322ms 4.3ms 12.9MB 310ms 0ms wasmtime 5.0.0
wasm 4.rs 332ms 3.2ms 12.9MB 317ms 0ms wasmtime 5.0.0
wasm 3.rs 337ms 0.5ms 14.8MB 320ms 0ms wasmtime 5.0.0
wasm 3.rs 389ms 13ms 46.2MB 393ms 7ms node 16.19.0
wasm 5.rs 390ms 8.9ms 45.2MB 400ms 7ms node 16.19.0
wasm 4.rs 392ms 3.8ms 45.1MB 403ms 10ms node 16.19.0
kotlin 1-m.kt 657ms 26ms 34.4MB 1093ms 130ms kotlin/native 1.8.10

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 3.rs 1809ms 30ms 49.9MB 1860ms 13ms node 16.19.0
wasm 3.rs 1955ms 5.0ms 12.9MB 1940ms 0ms wasmtime 5.0.0
wasm 3.rs 2468ms 7.7ms 17.3MB 2443ms 7ms wasmedgec 0.11.2
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
wasm 3.rs 131ms 0.6ms 11.6MB 117ms 0ms wasmtime 5.0.0
wasm 3.rs 168ms 5.8ms 15.9MB 157ms 0ms wasmedgec 0.11.2
wasm 3.rs 260ms 12ms 48.5MB 303ms 20ms node 16.19.0
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
wasm 1.rs 8.0ms 1.2ms 9.2MB 0ms 0ms wasmtime 5.0.0
wasm 1.rs 8.7ms 0.8ms 16.1MB 0ms 0ms wasmedgec 0.11.2
kotlin 1.kt 78ms 1.3ms 40.7MB 62ms 10ms kotlin/jvm 17.0.2
wasm 1.rs 96ms 4.6ms 43.5MB 110ms 4ms node 16.19.0

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
wasm 1.rs 185ms 0.4ms 15.7MB 170ms 0ms wasmedgec 0.11.2
wasm 1.rs 230ms 3.2ms 11.2MB 213ms 0ms wasmtime 5.0.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
wasm 1.rs 314ms 3.7ms 44.8MB 323ms 3ms node 16.19.0
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
wasm 1.rs 539ms 1.4ms 16.2MB 523ms 0ms wasmedgec 0.11.2
kotlin 1.kt 592ms 9.7ms 132.2MB 643ms 43ms kotlin/jvm 17.0.2
wasm 1.rs 665ms 1.8ms 11.2MB 650ms 0ms wasmtime 5.0.0
wasm 1.rs 738ms 4.8ms 44.5MB 750ms 10ms node 16.19.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
wasm 1.rs 100ms 3.4ms 15.1MB 87ms 0ms wasmedgec 0.11.2
wasm 1.rs 119ms 1.5ms 11.1MB 110ms 0ms wasmtime 5.0.0
wasm 1.rs 212ms 6.0ms 44.3MB 227ms 3ms node 16.19.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
wasm 1.rs 1482ms 1.7ms 39.6MB 1460ms 7ms wasmedgec 0.11.2
wasm 1.rs 1650ms 32ms 67.5MB 1647ms 17ms node 16.19.0
wasm 1.rs 1651ms 19ms 34.8MB 1623ms 10ms wasmtime 5.0.0
kotlin 1-m.kt 3664ms 86ms 138.6MB 5797ms 787ms kotlin/native 1.8.10

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
wasm 1.rs 323ms 7.6ms 21.7MB 303ms 0ms wasmedgec 0.11.2
wasm 1.rs 355ms 6.4ms 17.0MB 337ms 3ms wasmtime 5.0.0
wasm 1.rs 427ms 4.6ms 48.9MB 437ms 7ms node 16.19.0
kotlin 1-m.kt 732ms 13ms 38.4MB 1173ms 133ms kotlin/native 1.8.10

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 679ms 4.2ms 9.3MB 663ms 0ms wasmtime 5.0.0
wasm 1.rs 705ms 9.6ms 15.0MB 690ms 0ms wasmedgec 0.11.2
kotlin 1.kt 768ms 9.5ms 42.9MB 757ms 27ms kotlin/jvm 17.0.2
wasm 1.rs 779ms 2.6ms 47.5MB 800ms 15ms node 16.19.0
kotlin 1n.kt 837ms 45ms 1.5MB 827ms 0ms kotlin/native 1.8.10
wasm 2.rs 960ms 16ms 9.3MB 950ms 0ms wasmtime 5.0.0
wasm 2.rs 994ms 3.2ms 15.3MB 977ms 0ms wasmedgec 0.11.2
wasm 2.rs 1059ms 0.4ms 48.8MB 1073ms 13ms node 16.19.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 76ms 3.4ms 11.3MB 63ms 3ms wasmtime 5.0.0
wasm 1.rs 80ms 1.6ms 15.3MB 67ms 0ms wasmedgec 0.11.2
kotlin 1n.kt 88ms 3.6ms 1.5MB 80ms 0ms kotlin/native 1.8.10
wasm 2.rs 110ms 5.0ms 15.0MB 93ms 0ms wasmedgec 0.11.2
wasm 2.rs 110ms 9.3ms 11.2MB 93ms 0ms wasmtime 5.0.0
wasm 1.rs 183ms 5.6ms 48.1MB 200ms 13ms node 16.19.0
kotlin 1.kt 185ms 11ms 43.0MB 183ms 20ms kotlin/jvm 17.0.2
wasm 2.rs 219ms 7.2ms 48.7MB 240ms 13ms node 16.19.0

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 2934ms 12ms 17.6MB 2917ms 0ms wasmedgec 0.11.2
wasm 2.rs 3366ms 6.9ms 11.8MB 3347ms 0ms wasmtime 5.0.0
wasm 2.rs 3692ms 11ms 49.2MB 3730ms 17ms node 16.19.0
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
wasm 2.rs 699ms 5.8ms 16.4MB 683ms 0ms wasmedgec 0.11.2
wasm 2.rs 813ms 19ms 11.3MB 797ms 0ms wasmtime 5.0.0
wasm 2.rs 979ms 9.6ms 48.3MB 1023ms 17ms node 16.19.0
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
wasm 0.rs 455ms 4.4ms 15.4MB 440ms 0ms wasmedgec 0.11.2
wasm 0.rs 514ms 2.2ms 9.6MB 500ms 0ms wasmtime 5.0.0
wasm 0.rs 539ms 4.1ms 47.3MB 567ms 10ms node 16.19.0
kotlin 1.kt timeout 0.0ms 182.5MB 5997ms 97ms kotlin/jvm 17.0.2
wasm 1.rs timeout 0.0ms 58.8MB 5047ms 20ms node 16.19.0
wasm 1.rs timeout 0.0ms 16.5MB 4977ms 0ms wasmedgec 0.11.2
wasm 1.rs timeout 0.0ms 11.2MB 4983ms 0ms wasmtime 5.0.0

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 0.rs 126ms 2.2ms 16.0MB 110ms 0ms wasmedgec 0.11.2
wasm 0.rs 136ms 2.1ms 11.0MB 123ms 0ms wasmtime 5.0.0
wasm 0.rs 230ms 4.1ms 47.0MB 247ms 17ms node 16.19.0
wasm 1.rs 1299ms 17ms 15.6MB 1283ms 0ms wasmedgec 0.11.2
wasm 1.rs 1498ms 4.1ms 10.2MB 1477ms 0ms wasmtime 5.0.0
wasm 1.rs 1548ms 23ms 56.2MB 1583ms 30ms node 16.19.0
kotlin 1-m.kt 1604ms 20ms 182.9MB 2433ms 83ms kotlin/jvm 17.0.2