Kotlin VS Ruby 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
ruby 1.rb timeout 0.0ms 70.0MB 4953ms 37ms ruby 3.4.5
ruby 1.rb timeout 0.0ms 109.4MB 4920ms 70ms ruby/yjit 3.4.5
ruby 1.rb timeout 0.0ms 787.2MB 6683ms 693ms truffleruby 24.2.2

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
ruby 1.rb 509ms 7.0ms 20.3MB 483ms 10ms ruby/yjit 3.4.5
ruby 1-m.rb 635ms 20ms 428.0MB 1267ms 177ms truffleruby 24.2.2
ruby 1.rb 940ms 17ms 19.5MB 917ms 10ms ruby 3.4.5

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1.rb 1415ms 25ms 63.8MB 1330ms 67ms ruby/yjit 3.4.5
ruby 1.rb 1928ms 34ms 63.0MB 1853ms 63ms ruby 3.4.5
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
ruby 1.rb timeout 0.0ms 353.4MB 4533ms 1500ms truffleruby 24.2.2

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1.rb 151ms 2.0ms 25.6MB 120ms 17ms ruby/yjit 3.4.5
ruby 1.rb 187ms 8.1ms 25.1MB 153ms 17ms ruby 3.4.5
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
ruby 1.rb timeout 0.0ms 334.4MB 4743ms 1420ms truffleruby 24.2.2

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
ruby 1.rb 36ms 0.9ms 141.7MB 14ms 26ms truffleruby 24.2.2
ruby 1.rb 52ms 1.5ms 13.1MB 38ms 2ms ruby/yjit 3.4.5
ruby 1.rb 55ms 1.6ms 12.8MB 36ms 8ms ruby 3.4.5
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
ruby 1.rb 251ms 0.9ms 27.6MB 223ms 13ms ruby/yjit 3.4.5
ruby 1.rb 259ms 4.1ms 27.6MB 233ms 10ms ruby 3.4.5
kotlin 1-m.kt 790ms 75ms 174.3MB 2133ms 93ms kotlin/jvm 21
ruby 1-m.rb 4471ms 224ms 505.6MB 11703ms 343ms truffleruby 24.2.2

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
ruby 1.rb 2101ms 3.6ms 132.3MB 2010ms 77ms ruby/yjit 3.4.5
ruby 1.rb 2111ms 19ms 133.0MB 2023ms 70ms ruby 3.4.5
ruby 1.rb timeout 0.0ms 505.5MB 13147ms 380ms truffleruby 24.2.2

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
ruby 1.rb 335ms 0.3ms 13.5MB 313ms 7ms ruby/yjit 3.4.5
kotlin 1.kt 361ms 3.8ms 12.4MB 363ms 0ms kotlin/native 2.1.20
ruby 1.rb 551ms 4.0ms 12.9MB 530ms 3ms ruby 3.4.5
ruby 1-m.rb 730ms 8.7ms 365.9MB 1337ms 147ms truffleruby 24.2.2

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
ruby 1.rb 900ms 12ms 13.5MB 877ms 10ms ruby/yjit 3.4.5
kotlin 1.kt 1059ms 5.6ms 12.5MB 1090ms 7ms kotlin/native 2.1.20
ruby 1-m.rb 1308ms 61ms 421.6MB 1850ms 193ms truffleruby 24.2.2
ruby 1.rb 1524ms 25ms 12.9MB 1510ms 0ms ruby 3.4.5

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
ruby 1.rb 196ms 1.8ms 13.5MB 177ms 3ms ruby/yjit 3.4.5
ruby 1.rb 303ms 5.0ms 12.8MB 283ms 3ms ruby 3.4.5
ruby 1-m.rb 520ms 25ms 358.0MB 1023ms 143ms truffleruby 24.2.2

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
ruby 1-m.rb 3884ms 62ms 536.7MB 9777ms 367ms truffleruby 24.2.2
ruby 1.rb timeout 0.0ms 94.1MB 4943ms 43ms ruby 3.4.5
ruby 1.rb timeout 0.0ms 94.1MB 4937ms 50ms ruby/yjit 3.4.5

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
ruby 1-m.rb 1987ms 49ms 588.0MB 5123ms 283ms truffleruby 24.2.2
ruby 1.rb 3281ms 18ms 38.3MB 3247ms 20ms ruby/yjit 3.4.5
ruby 1.rb 4404ms 9.7ms 37.6MB 4367ms 20ms ruby 3.4.5

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
ruby 2.rb 833ms 18ms 322.1MB 1097ms 117ms truffleruby 24.2.2
ruby 2.rb timeout 0.0ms 12.8MB 4983ms 3ms ruby 3.4.5
ruby 2.rb timeout 0.0ms 13.5MB 4980ms 7ms ruby/yjit 3.4.5

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
ruby 2-m.rb 324ms 16ms 309.6MB 573ms 117ms truffleruby 24.2.2
ruby 2.rb 1047ms 3.1ms 13.5MB 1030ms 0ms ruby/yjit 3.4.5
ruby 2.rb 2780ms 54ms 12.8MB 2763ms 3ms ruby 3.4.5

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
ruby 1.rb timeout 0.0ms 130.0MB 4823ms 163ms ruby 3.4.5
ruby 1.rb timeout 0.0ms 131.0MB 4830ms 160ms ruby/yjit 3.4.5
ruby 1.rb timeout 0.0ms 458.8MB 13220ms 440ms truffleruby 24.2.2

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
ruby 1-m.rb 1492ms 74ms 387.7MB 3950ms 187ms truffleruby 24.2.2
ruby 1.rb 1790ms 21ms 130.9MB 1647ms 130ms ruby/yjit 3.4.5
ruby 1.rb 1815ms 23ms 130.0MB 1670ms 130ms ruby 3.4.5
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