Javascript VS Go 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
javascript 1-m.js 1005ms 34ms 179.3MB 1543ms 267ms bun 1.2.7
go 1.go 1214ms 12ms 55.0MB 1190ms 10ms tinygo 0.37.0
javascript 1-m.js 1224ms 3.5ms 250.8MB 2130ms 153ms node 23.10.0
go 1-m.go 2372ms 13ms 46.1MB 5267ms 43ms go 1.24.1

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
javascript 1.js 100ms 0.5ms 79.1MB 73ms 27ms bun 1.2.7
go 1.go 115ms 1.5ms 5.6MB 107ms 0ms tinygo 0.37.0
javascript 1.js 126ms 0.7ms 78.8MB 130ms 23ms node 23.10.0
go 1-m.go 209ms 0.5ms 8.0MB 370ms 10ms go 1.24.1

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 1-m.go 473ms 8.9ms 15.6MB 1833ms 3ms go 1.24.1
go 1.go 723ms 8.5ms 269.4MB 670ms 37ms tinygo 0.37.0
javascript 1.js 1662ms 72ms 90.2MB 1733ms 57ms node 23.10.0
javascript 1.js 2500ms 20ms 101.3MB 2520ms 70ms bun 1.2.7

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 1-m.go 38ms 6.0ms 7.5MB 123ms 0ms go 1.24.1
go 1.go 70ms 2.6ms 68.3MB 50ms 10ms tinygo 0.37.0
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

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 1.go 117ms 1.7ms 8.4MB 110ms 0ms go 1.24.1
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
go 1.go 33ms 0.5ms 8.2MB 23ms 0ms go 1.24.1
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
go 1.go 0.9ms 0.1ms 0.4MB 0ms 0ms tinygo 0.37.0
go 1.go 1.5ms 0.1ms 3.4MB 0ms 0ms go 1.24.1
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

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 1-http2.go 119ms 3.6ms 56.1MB 323ms 80ms go 1.24.1
javascript 1-m.bun.js 330ms 13ms 76.0MB 143ms 420ms bun 1.2.7
go 1-m.go 398ms 12ms 176.8MB 660ms 667ms go 1.24.1
go 2-m.go 421ms 8.9ms 172.6MB 703ms 713ms go 1.24.1
javascript 1.js 2961ms 150ms 188.6MB 2830ms 1410ms node 23.10.0

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 2-m.go 25ms 28ms 28.6MB 60ms 70ms go 1.24.1
go 1-http2.go 32ms 4.0ms 25.3MB 60ms 20ms go 1.24.1
go 1-m.go 78ms 2.4ms 36.8MB 110ms 103ms go 1.24.1
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

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 2-ffi.go 46ms 1.9ms 41.2MB 40ms 7ms go 1.24.1
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
go 1.go 139ms 1.2ms 18.6MB 133ms 0ms go 1.24.1

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 2-ffi.go 244ms 7.5ms 141.3MB 240ms 30ms go 1.24.1
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
go 1.go 746ms 2.5ms 105.0MB 733ms 10ms go 1.24.1

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 3.go 121ms 2.5ms 3.5MB 113ms 0ms go 1.24.1
go 3.go 131ms 2.2ms 0.5MB 123ms 0ms tinygo 0.37.0
javascript 2.js 310ms 0.4ms 63.1MB 297ms 20ms node 23.10.0
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
go 3.go 388ms 13ms 3.5MB 380ms 0ms go 1.24.1
go 3.go 388ms 2.2ms 0.5MB 380ms 0ms tinygo 0.37.0
javascript 2.js 850ms 1.6ms 68.3MB 837ms 20ms node 23.10.0
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
go 3.go 51ms 1.0ms 3.5MB 40ms 0ms go 1.24.1
go 3.go 64ms 1.6ms 0.4MB 57ms 0ms tinygo 0.37.0
javascript 1.js 162ms 0.8ms 58.0MB 147ms 13ms node 23.10.0
javascript 2.js 166ms 0.3ms 56.7MB 160ms 10ms node 23.10.0
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
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
go 1.go 820ms 47ms 63.2MB 797ms 10ms tinygo 0.37.0
go 2.go 1112ms 7.9ms 55.0MB 1093ms 3ms tinygo 0.37.0
go 1-m.go 1461ms 6.1ms 39.0MB 3090ms 37ms go 1.24.1
go 2-m.go 1661ms 2.3ms 42.9MB 3680ms 40ms go 1.24.1

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
javascript 1.js 160ms 2.0ms 98.4MB 163ms 33ms node 23.10.0
go 1.go 176ms 2.5ms 9.8MB 160ms 0ms tinygo 0.37.0
go 2.go 206ms 2.2ms 17.1MB 190ms 0ms tinygo 0.37.0
go 1-m.go 332ms 4.7ms 12.2MB 677ms 20ms go 1.24.1
go 2-m.go 373ms 2.8ms 13.9MB 787ms 27ms go 1.24.1

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 1.go 349ms 3.0ms 0.4MB 340ms 0ms tinygo 0.37.0
go 1.go 352ms 2.1ms 3.5MB 343ms 0ms go 1.24.1
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
go 1.go 37ms 0.1ms 3.5MB 30ms 0ms go 1.24.1
go 1.go 38ms 0.7ms 0.4MB 30ms 0ms tinygo 0.37.0
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

secp256k1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 0-ffi.go 92ms 0.3ms 5.2MB 87ms 0ms go 1.24.1
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

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 0-ffi.go 25ms 0.7ms 5.2MB 20ms 0ms go 1.24.1
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

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 8.go 1173ms 7.7ms 8.7MB 1157ms 0ms go 1.24.1
javascript 3.js timeout 0.0ms 87.9MB 4983ms 27ms node 23.10.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 8.go 280ms 1.6ms 8.6MB 270ms 0ms go 1.24.1
javascript 3.js 1099ms 2.6ms 70.8MB 1080ms 17ms node 23.10.0

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 4-m.go 1911ms 17ms 4.3MB 7403ms 10ms go 1.24.1
javascript 6-m.js 2181ms 15ms 114.1MB 8247ms 60ms node 23.10.0
go 1.go 3659ms 12ms 5.6MB 3650ms 0ms go 1.24.1
go 1.go timeout 0.0ms 0.5MB 4990ms 0ms tinygo 0.37.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 4-m.go 481ms 0.6ms 5.5MB 1843ms 0ms go 1.24.1
javascript 6-m.js 656ms 7.6ms 113.5MB 2320ms 53ms node 23.10.0
go 1.go 916ms 4.3ms 3.5MB 910ms 0ms go 1.24.1
go 1.go 1397ms 0.4ms 0.5MB 1387ms 0ms tinygo 0.37.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 4-m.go 125ms 0.8ms 5.5MB 450ms 0ms go 1.24.1
go 1.go 231ms 1.3ms 3.5MB 220ms 0ms go 1.24.1
javascript 6-m.js 266ms 1.5ms 109.7MB 813ms 50ms node 23.10.0
go 1.go 352ms 0.6ms 0.4MB 340ms 0ms tinygo 0.37.0