Javascript VS Kotlin benchmarks

Current benchmark data was generated on Mon Mar 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 474ms 2.2ms 577.6MB 567ms 83ms kotlin/jvm 21
javascript 1-m.js 1005ms 34ms 179.3MB 1543ms 267ms bun 1.2.7
javascript 1-m.js 1224ms 3.5ms 250.8MB 2130ms 153ms node 23.10.0
kotlin 1-m.kt 3074ms 28ms 246.4MB 5113ms 703ms kotlin/native 1.8.21

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 100ms 0.6ms 160.2MB 110ms 27ms kotlin/jvm 21
javascript 1.js 100ms 0.5ms 79.1MB 73ms 27ms bun 1.2.7
javascript 1.js 126ms 0.7ms 78.8MB 130ms 23ms node 23.10.0
kotlin 1-m.kt 267ms 2.6ms 28.5MB 427ms 57ms kotlin/native 1.8.21

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
javascript 1.js 1662ms 72ms 90.2MB 1733ms 57ms node 23.10.0
kotlin 2-m.kt 1924ms 65ms 240.6MB 7167ms 113ms kotlin/jvm 21
kotlin 1.kt 2164ms 23ms 222.7MB 2980ms 73ms kotlin/jvm 21
javascript 1.js 2500ms 20ms 101.3MB 2520ms 70ms bun 1.2.7
kotlin 1.kt timeout 0.0ms 12.7MB 6027ms 467ms kotlin/native 1.8.21
kotlin 2-m.kt timeout 0.0ms 53.1MB 19010ms 150ms kotlin/native 1.8.21

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
javascript 1.js 158ms 4.4ms 72.7MB 143ms 27ms node 23.10.0
javascript 1.js 199ms 0.9ms 88.4MB 220ms 33ms bun 1.2.7
kotlin 2-m.kt 433ms 6.8ms 12.8MB 1593ms 23ms kotlin/native 1.8.21
kotlin 1-m.kt 480ms 14ms 77.5MB 1110ms 53ms kotlin/jvm 21
kotlin 1.kt 685ms 0.7ms 8.8MB 813ms 63ms kotlin/native 1.8.21
kotlin 2-m.kt 926ms 49ms 105.6MB 3263ms 83ms kotlin/jvm 21

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
javascript 1.js 285ms 4.3ms 63.7MB 300ms 27ms node 23.10.0
javascript 1.js 526ms 4.8ms 78.0MB 497ms 20ms bun 1.2.7

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
javascript 1.js 144ms 12ms 62.0MB 160ms 20ms node 23.10.0
javascript 1.js 500ms 3.9ms 67.7MB 470ms 23ms bun 1.2.7

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 2.0ms 0.2ms 2.5MB 0ms 0ms kotlin/native 1.8.21
javascript 1.js 13ms 0.3ms 33.3MB 0ms 0ms bun 1.2.7
javascript 1.js 31ms 0.3ms 47.9MB 18ms 2ms node 23.10.0
kotlin 1.kt 56ms 5.4ms 47.2MB 50ms 20ms kotlin/jvm 21

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
javascript 1-m.bun.js 330ms 13ms 76.0MB 143ms 420ms bun 1.2.7
javascript 1.js 2961ms 150ms 188.6MB 2830ms 1410ms node 23.10.0
kotlin 2-m.kt 3184ms 1331ms 354.5MB 5353ms 940ms kotlin/jvm 21
kotlin 1.kt timeout 0.0ms 407.6MB 15893ms 3003ms kotlin/jvm 21

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
javascript 1.bun.js 108ms 7.0ms 55.8MB 30ms 87ms bun 1.2.7
javascript 1.js 362ms 2.6ms 79.9MB 350ms 113ms node 23.10.0
kotlin 1-m.kt 2024ms 205ms 231.8MB 6097ms 673ms kotlin/jvm 21
kotlin 2-m.kt 2068ms 276ms 242.2MB 5587ms 597ms kotlin/jvm 21

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
javascript 1.js 81ms 7.1ms 70.9MB 50ms 20ms bun 1.2.7
javascript 1.js 109ms 1.2ms 75.7MB 97ms 17ms node 23.10.0
kotlin 1-m.kt 806ms 107ms 204.8MB 2167ms 87ms kotlin/jvm 21

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
javascript 1.js 412ms 4.6ms 268.3MB 340ms 117ms bun 1.2.7
javascript 1.js 690ms 2.7ms 200.9MB 803ms 80ms node 23.10.0
kotlin 1-m.kt 2329ms 35ms 828.1MB 5040ms 157ms kotlin/jvm 21

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1-m.kt 181ms 3.8ms 96.7MB 300ms 30ms kotlin/jvm 21
kotlin 2-m.kt 197ms 1.3ms 103.5MB 420ms 40ms kotlin/jvm 21
kotlin 2.kt 299ms 2.1ms 5.8MB 420ms 10ms kotlin/native 1.8.21
javascript 2.js 310ms 0.4ms 63.1MB 297ms 20ms node 23.10.0
kotlin 1.kt 515ms 4.2ms 5.9MB 613ms 10ms kotlin/native 1.8.21
javascript 1.js 553ms 2.0ms 60.8MB 540ms 10ms node 23.10.0
javascript 2.js 653ms 5.3ms 123.0MB 710ms 60ms bun 1.2.7
javascript 1.js 821ms 7.2ms 107.4MB 903ms 77ms bun 1.2.7

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 2-m.kt 311ms 8.5ms 212.5MB 533ms 47ms kotlin/jvm 21
kotlin 1.kt 343ms 9.7ms 204.4MB 443ms 43ms kotlin/jvm 21
javascript 2.js 850ms 1.6ms 68.3MB 837ms 20ms node 23.10.0
kotlin 2.kt 893ms 4.3ms 5.8MB 1280ms 50ms kotlin/native 1.8.21
kotlin 1.kt 1545ms 11ms 5.8MB 1860ms 23ms kotlin/native 1.8.21
javascript 1.js 1586ms 4.8ms 67.9MB 1570ms 13ms node 23.10.0
javascript 2.js 1819ms 7.8ms 123.2MB 1987ms 67ms bun 1.2.7
javascript 1.js 2374ms 11ms 111.6MB 2680ms 147ms bun 1.2.7

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1-m.kt 138ms 2.2ms 92.7MB 273ms 23ms kotlin/jvm 21
kotlin 2.kt 140ms 1.1ms 3.6MB 193ms 0ms kotlin/native 1.8.21
javascript 1.js 162ms 0.8ms 58.0MB 147ms 13ms node 23.10.0
kotlin 2-m.kt 166ms 21ms 95.2MB 347ms 23ms kotlin/jvm 21
javascript 2.js 166ms 0.3ms 56.7MB 160ms 10ms node 23.10.0
kotlin 1.kt 171ms 1.1ms 3.8MB 210ms 3ms kotlin/native 1.8.21
javascript 1.js 315ms 2.8ms 115.1MB 343ms 80ms bun 1.2.7
javascript 2.js 357ms 1.7ms 126.5MB 370ms 57ms bun 1.2.7

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 351ms 4.3ms 679.4MB 377ms 93ms kotlin/jvm 21
javascript 1-m.js 479ms 7.3ms 152.6MB 623ms 137ms bun 1.2.7
javascript 1.js 530ms 2.1ms 130.6MB 613ms 57ms node 23.10.0
kotlin 1-m.kt 1499ms 16ms 134.5MB 2310ms 327ms kotlin/native 1.8.21

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
javascript 1.js 116ms 2.3ms 88.1MB 103ms 33ms bun 1.2.7
kotlin 1.kt 129ms 2.5ms 208.5MB 153ms 40ms kotlin/jvm 21
javascript 1.js 160ms 2.0ms 98.4MB 163ms 33ms node 23.10.0
kotlin 1-m.kt 310ms 3.8ms 38.6MB 453ms 67ms kotlin/native 1.8.21

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1n.kt 406ms 0.5ms 2.5MB 397ms 0ms kotlin/native 1.8.21
kotlin 1.kt 445ms 1.6ms 49.5MB 487ms 20ms kotlin/jvm 21
javascript 6.js 458ms 4.1ms 55.9MB 447ms 10ms node 23.10.0
javascript 6.js 780ms 18ms 46.1MB 773ms 0ms bun 1.2.7

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1n.kt 47ms 1.9ms 2.5MB 40ms 0ms kotlin/native 1.8.21
javascript 6.js 79ms 1.0ms 56.2MB 67ms 10ms node 23.10.0
javascript 6.js 98ms 1.2ms 46.3MB 93ms 7ms bun 1.2.7
kotlin 1-m.kt 119ms 0.0ms 49.6MB 163ms 17ms kotlin/jvm 21

secp256k1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
javascript 1.js 2521ms 12ms 59.2MB 2527ms 30ms node 23.10.0
javascript 1.js 2842ms 3.4ms 84.8MB 2857ms 50ms bun 1.2.7
kotlin 1.kt 3092ms 51ms 235.3MB 4100ms 73ms kotlin/jvm 21

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
javascript 1.js 671ms 1.0ms 57.7MB 677ms 13ms node 23.10.0
javascript 1.js 745ms 4.9ms 84.5MB 740ms 33ms bun 1.2.7
kotlin 1-m.kt 978ms 29ms 233.2MB 1787ms 60ms kotlin/jvm 21

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 3686ms 7.3ms 354.4MB 4587ms 103ms kotlin/jvm 21
javascript 3.js timeout 0.0ms 87.9MB 4983ms 27ms node 23.10.0
kotlin 1n.kt timeout 0.0ms 5.5MB 6277ms 270ms kotlin/native 1.8.21
kotlin 2n.kt timeout 0.0ms 6.2MB 5017ms 143ms kotlin/native 1.8.21

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1-m.kt 1008ms 11ms 355.1MB 1733ms 90ms kotlin/jvm 21
javascript 3.js 1099ms 2.6ms 70.8MB 1080ms 17ms node 23.10.0
kotlin 1n.kt timeout 0.0ms 5.4MB 6273ms 273ms kotlin/native 1.8.21
kotlin 2n.kt timeout 0.0ms 6.3MB 5003ms 160ms kotlin/native 1.8.21

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
javascript 6-m.js 2181ms 15ms 114.1MB 8247ms 60ms node 23.10.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
javascript 6-m.js 656ms 7.6ms 113.5MB 2320ms 53ms node 23.10.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
javascript 6-m.js 266ms 1.5ms 109.7MB 813ms 50ms node 23.10.0