Kotlin VS Codon benchmarks

Current benchmark data was generated on Thu Jul 31 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.)

binarytrees

Input: 18

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 500ms 4.3ms 582.2MB 597ms 93ms kotlin/jvm 21
kotlin 1.kt 4153ms 24ms 139.8MB 4337ms 70ms kotlin/native 2.1.20

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 123ms 3.2ms 159.4MB 147ms 30ms kotlin/jvm 21
kotlin 1.kt 214ms 3.1ms 17.3MB 220ms 10ms kotlin/native 2.1.20

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 2-m.kt 1959ms 23ms 236.7MB 7320ms 97ms kotlin/jvm 21
kotlin 1.kt 2193ms 31ms 220.3MB 3043ms 73ms kotlin/jvm 21
kotlin 2-m.kt 4226ms 29ms 21.1MB 14107ms 557ms kotlin/native 2.1.20
kotlin 1.kt timeout 0.0ms 17.4MB 5513ms 27ms kotlin/native 2.1.20

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 2-m.kt 248ms 1.9ms 21.6MB 833ms 40ms kotlin/native 2.1.20
kotlin 1.kt 389ms 7.6ms 17.4MB 400ms 7ms kotlin/native 2.1.20
kotlin 1-m.kt 481ms 5.6ms 75.1MB 1123ms 40ms kotlin/jvm 21
kotlin 2-m.kt 912ms 91ms 101.8MB 3210ms 67ms kotlin/jvm 21

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 2.2ms 0.2ms 3.0MB 0ms 0ms kotlin/native 2.1.20
codon 1-m.py 12ms 0.5ms 8.4MB 20ms 0ms codon 0.19.1
kotlin 1.kt 63ms 1.6ms 47.6MB 78ms 16ms kotlin/jvm 21

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt timeout 0.0ms 418.3MB 16207ms 2813ms kotlin/jvm 21
kotlin 2.kt timeout 0.0ms 464.3MB 15393ms 2633ms kotlin/jvm 21

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 2-m.kt 1941ms 79ms 239.5MB 5763ms 667ms kotlin/jvm 21
kotlin 1-m.kt 2109ms 160ms 258.7MB 6000ms 713ms kotlin/jvm 21

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1-m.kt 790ms 75ms 174.3MB 2133ms 93ms kotlin/jvm 21

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1-m.kt 1809ms 69ms 671.0MB 4253ms 157ms kotlin/jvm 21

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 2.kt 167ms 3.2ms 12.4MB 170ms 3ms kotlin/native 2.1.20
kotlin 1-m.kt 200ms 5.2ms 94.6MB 320ms 30ms kotlin/jvm 21
kotlin 2-m.kt 214ms 17ms 101.4MB 453ms 40ms kotlin/jvm 21
kotlin 1.kt 361ms 3.8ms 12.4MB 363ms 0ms kotlin/native 2.1.20

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 2-m.kt 324ms 3.1ms 211.0MB 560ms 47ms kotlin/jvm 21
kotlin 1.kt 342ms 1.5ms 202.9MB 457ms 40ms kotlin/jvm 21
kotlin 2.kt 473ms 4.4ms 12.4MB 507ms 0ms kotlin/native 2.1.20
kotlin 1.kt 1059ms 5.6ms 12.5MB 1090ms 7ms kotlin/native 2.1.20

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 2.kt 95ms 1.0ms 12.8MB 90ms 0ms kotlin/native 2.1.20
kotlin 1.kt 124ms 0.9ms 12.8MB 120ms 0ms kotlin/native 2.1.20
kotlin 1-m.kt 156ms 1.5ms 90.6MB 297ms 30ms kotlin/jvm 21
kotlin 2-m.kt 186ms 18ms 95.8MB 403ms 30ms kotlin/jvm 21

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 391ms 5.6ms 680.6MB 437ms 97ms kotlin/jvm 21
kotlin 1.kt 1991ms 6.4ms 89.8MB 2083ms 43ms kotlin/native 2.1.20

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1-m.kt 161ms 7.1ms 207.1MB 213ms 43ms kotlin/jvm 21
kotlin 1.kt 269ms 4.3ms 25.6MB 270ms 13ms kotlin/native 2.1.20

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1n.kt 353ms 3.9ms 3.5MB 343ms 0ms kotlin/native 2.1.20
kotlin 1.kt 445ms 0.8ms 49.6MB 490ms 17ms kotlin/jvm 21
codon 1.py 1339ms 1.9ms 9.6MB 1650ms 0ms codon 0.19.1

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1n.kt 38ms 0.1ms 3.6MB 30ms 0ms kotlin/native 2.1.20
kotlin 1-m.kt 122ms 0.9ms 49.4MB 170ms 20ms kotlin/jvm 21
codon 1-m.py 184ms 13ms 9.6MB 490ms 0ms codon 0.19.1

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 3764ms 47ms 353.1MB 4593ms 113ms kotlin/jvm 21
kotlin 1n.kt timeout 0.0ms 26.8MB 4010ms 1507ms kotlin/native 2.1.20
kotlin 2n.kt timeout 0.0ms 30.9MB 5120ms 133ms kotlin/native 2.1.20

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1-m.kt 1016ms 41ms 354.4MB 1783ms 93ms kotlin/jvm 21
kotlin 1n.kt timeout 0.0ms 26.8MB 4027ms 1493ms kotlin/native 2.1.20
kotlin 2n.kt timeout 0.0ms 30.6MB 5107ms 137ms kotlin/native 2.1.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 173.4MB 5420ms 43ms kotlin/jvm 21
kotlin 1n.kt timeout 0.0ms 226.8MB 5067ms 137ms kotlin/native 2.1.20

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1-m.kt 851ms 6.0ms 134.4MB 1307ms 43ms kotlin/jvm 21
kotlin 1n.kt 3267ms 74ms 51.1MB 3343ms 80ms kotlin/native 2.1.20

secp256k1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 3078ms 26ms 231.8MB 4007ms 60ms kotlin/jvm 21

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1-m.kt 996ms 40ms 231.6MB 1827ms 63ms kotlin/jvm 21