V VS Kotlin benchmarks

Current benchmark data was generated on Mon Oct 03 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
kotlin 1.kt 630ms 12ms 413.5MB 673ms 63ms kotlin/jvm 17.0.2
v 1.v 1081ms 4.2ms 37.1MB 1060ms 10ms v/clang+gc 0.3.1
v 1.v 1096ms 11ms 37.1MB 1080ms 3ms v/clang 0.3.1
kotlin 1.kt timeout 0.0ms 0.0MB 0ms 0ms kotlin/native 1.7.20

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 112ms 1.5ms 5.6MB 100ms 0ms v/clang+gc 0.3.1
v 1.v 113ms 1.2ms 5.5MB 100ms 0ms v/clang 0.3.1
kotlin 1.kt 135ms 16ms 109.6MB 130ms 20ms kotlin/jvm 17.0.2
kotlin 1-m.kt 411ms 10ms 42.6MB 653ms 10ms kotlin/native 1.7.20

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 2-m.kt 2846ms 155ms 182.7MB 5393ms 60ms kotlin/jvm 17.0.2
kotlin 1.kt 2911ms 11ms 160.2MB 3757ms 57ms kotlin/jvm 17.0.2
kotlin 1.kt timeout 0.0ms 0.0MB 0ms 0ms kotlin/native 1.7.20
kotlin 2-m.kt timeout 0.0ms 0.0MB 0ms 0ms kotlin/native 1.7.20
v 1.v timeout 0.0ms 0.0MB 0ms 0ms v/clang 0.3.1
v 1.v timeout 0.0ms 0.0MB 0ms 0ms v/clang+gc 0.3.1

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1-m.kt 717ms 12ms 95.9MB 1253ms 53ms kotlin/jvm 17.0.2
kotlin 2-m.kt 812ms 42ms 36.5MB 1453ms 13ms kotlin/native 1.7.20
kotlin 1.kt 1014ms 7.1ms 8.9MB 1157ms 7ms kotlin/native 1.7.20
kotlin 2-m.kt 1040ms 12ms 105.8MB 1903ms 43ms kotlin/jvm 17.0.2
v 1-m.v 1954ms 19ms 20.4MB 1920ms 1750ms v/clang+gc 0.3.1
v 1.v timeout 0.0ms 0.0MB 0ms 0ms v/clang 0.3.1

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v timeout 0.0ms 0.0MB 0ms 0ms v/clang+gc 0.3.1

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v timeout 0.0ms 0.0MB 0ms 0ms v/clang+gc 0.3.1

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 3320ms 3.6ms 2.0MB 3310ms 0ms v/clang+gc 0.3.1
v 1.v 3348ms 2.4ms 2.1MB 3337ms 0ms v/clang 0.3.1

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 278ms 1.5ms 2.1MB 270ms 0ms v/clang+gc 0.3.1
v 1.v 283ms 2.8ms 2.0MB 270ms 0ms v/clang 0.3.1

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 569ms 0.9ms 2.2MB 553ms 0ms v/clang+gc 0.3.1
v 1.v 569ms 1.7ms 2.2MB 553ms 0ms v/clang 0.3.1

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 60ms 0.6ms 2.2MB 50ms 0ms v/clang+gc 0.3.1
v 1.v 62ms 3.2ms 2.3MB 50ms 0ms v/clang 0.3.1

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 2.1ms 0.2ms 2.0MB 0ms 0ms v/clang+gc 0.3.1
v 1.v 2.6ms 0.6ms 2.0MB 0ms 0ms v/clang 0.3.1
kotlin 1.kt 3.0ms 0.8ms 1.2MB 0ms 0ms kotlin/native 1.7.20
kotlin 1.kt 66ms 4.9ms 41.0MB 46ms 16ms kotlin/jvm 17.0.2

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 2-m.kt 219ms 2.9ms 113.0MB 323ms 23ms kotlin/jvm 17.0.2
kotlin 1.kt 235ms 1.6ms 109.5MB 293ms 17ms kotlin/jvm 17.0.2
v 1.v 418ms 0.4ms 2.2MB 410ms 0ms v/clang+gc 0.3.1
v 1.v 427ms 0.4ms 2.3MB 420ms 0ms v/clang 0.3.1
kotlin 2-m.kt 441ms 4.2ms 42.4MB 730ms 3ms kotlin/native 1.7.20
kotlin 1.kt timeout 0.0ms 0.0MB 0ms 0ms kotlin/native 1.7.20

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 2.kt 365ms 2.6ms 129.5MB 467ms 30ms kotlin/jvm 17.0.2
kotlin 1.kt 454ms 1.4ms 138.4MB 503ms 30ms kotlin/jvm 17.0.2
v 1.v 1248ms 2.5ms 2.2MB 1240ms 0ms v/clang+gc 0.3.1
v 1.v 1278ms 1.8ms 2.3MB 1267ms 0ms v/clang 0.3.1
kotlin 2-m.kt 1339ms 41ms 147.6MB 2167ms 47ms kotlin/native 1.7.20
kotlin 1.kt timeout 0.0ms 0.0MB 0ms 0ms kotlin/native 1.7.20

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 136ms 0.8ms 2.3MB 127ms 0ms v/clang+gc 0.3.1
v 1.v 141ms 0.8ms 2.2MB 130ms 0ms v/clang 0.3.1
kotlin 1-m.kt 170ms 0.3ms 75.9MB 247ms 13ms kotlin/jvm 17.0.2
kotlin 2-m.kt 183ms 3.1ms 78.7MB 253ms 27ms kotlin/jvm 17.0.2
kotlin 2-m.kt 229ms 0.3ms 30.3MB 383ms 7ms kotlin/native 1.7.20
kotlin 1.kt timeout 0.0ms 0.0MB 0ms 0ms kotlin/native 1.7.20

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 427ms 0.7ms 5.0MB 413ms 0ms v/clang+gc 0.3.1
v 1.v 436ms 1.0ms 8.4MB 423ms 0ms v/clang 0.3.1

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 21ms 0.7ms 2.2MB 10ms 0ms v/clang+gc 0.3.1
v 1.v 21ms 1.1ms 2.3MB 10ms 0ms v/clang 0.3.1

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 566ms 1.6ms 42.9MB 580ms 13ms kotlin/jvm 17.0.2
kotlin 1n.kt 577ms 55ms 1.2MB 567ms 0ms kotlin/native 1.7.20
v 1.v 1041ms 44ms 2.3MB 1030ms 0ms v/clang+gc 0.3.1
v 1.v 1070ms 92ms 2.3MB 1053ms 0ms v/clang 0.3.1

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1n.kt 58ms 0.3ms 1.2MB 50ms 0ms kotlin/native 1.7.20
v 1.v 104ms 0.2ms 2.4MB 93ms 0ms v/clang+gc 0.3.1
v 1.v 105ms 0.3ms 2.3MB 93ms 0ms v/clang 0.3.1
kotlin 1.kt 136ms 0.9ms 43.1MB 150ms 7ms kotlin/jvm 17.0.2

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 2.v 500ms 1.7ms 10.6MB 487ms 0ms v/clang 0.3.1
v 2.v 501ms 2.9ms 10.5MB 487ms 0ms v/clang+gc 0.3.1
v 1.v 646ms 4.7ms 41.2MB 627ms 3ms v/clang+gc 0.3.1
v 1.v 653ms 36ms 41.2MB 637ms 0ms v/clang 0.3.1

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 115ms 1.4ms 19.0MB 100ms 0ms v/clang+gc 0.3.1
v 2.v 116ms 0.4ms 3.3MB 110ms 0ms v/clang 0.3.1
v 1.v 116ms 0.9ms 19.5MB 100ms 0ms v/clang 0.3.1
v 2.v 116ms 0.3ms 3.3MB 100ms 0ms v/clang+gc 0.3.1

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 4729ms 31ms 3.3MB 4703ms 3ms v/clang+gc 0.3.1
kotlin 1.kt timeout 0.0ms 0.0MB 0ms 0ms kotlin/jvm 17.0.2
kotlin 1n.kt timeout 0.0ms 0.0MB 0ms 0ms kotlin/native 1.7.20
kotlin 2n.kt timeout 0.0ms 0.0MB 0ms 0ms kotlin/native 1.7.20
v 1.v timeout 0.0ms 0.0MB 0ms 0ms v/clang 0.3.1
v 2.v timeout 0.0ms 0.0MB 0ms 0ms v/clang+gc 0.3.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 1153ms 23ms 2.7MB 1140ms 0ms v/clang+gc 0.3.1
v 2.v 1457ms 5.6ms 3.1MB 1447ms 0ms v/clang+gc 0.3.1
kotlin 1.kt 1459ms 42ms 205.9MB 1767ms 57ms kotlin/jvm 17.0.2
v 1.v 1621ms 74ms 3.0MB 1600ms 3ms v/clang 0.3.1
kotlin 1n.kt timeout 0.0ms 0.0MB 0ms 0ms kotlin/native 1.7.20
kotlin 2n.kt timeout 0.0ms 0.0MB 0ms 0ms kotlin/native 1.7.20

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 0.0MB 0ms 0ms kotlin/jvm 17.0.2
kotlin 1n.kt timeout 0.0ms 0.0MB 0ms 0ms kotlin/native 1.7.20
v 1.v timeout 0.0ms 0.0MB 0ms 0ms v/clang+gc 0.3.1

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 1070ms 13ms 95.0MB 1467ms 30ms kotlin/jvm 17.0.2
kotlin 1n.kt 4349ms 20ms 65.2MB 5673ms 17ms kotlin/native 1.7.20
v 1.v 4360ms 13ms 26.1MB 4340ms 3ms v/clang+gc 0.3.1

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 4120ms 0.8ms 2.8MB 4110ms 0ms v/clang 0.3.1
v 1.v 4121ms 0.4ms 2.9MB 4110ms 0ms v/clang+gc 0.3.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 1033ms 0.5ms 2.6MB 1017ms 0ms v/clang+gc 0.3.1
v 1.v 1034ms 1.3ms 2.6MB 1023ms 0ms v/clang 0.3.1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 261ms 0.6ms 2.6MB 250ms 0ms v/clang+gc 0.3.1
v 1.v 261ms 0.6ms 2.6MB 250ms 0ms v/clang 0.3.1