Typescript VS Nim benchmarks

Current benchmark data was generated on Tue Nov 26 2024, 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
nim 2.nim 778ms 7.3ms 34.8MB 763ms 0ms nim 2.2.0
nim 2.nim 953ms 21ms 34.7MB 937ms 3ms nim/clang 2.2.0
typescript 1-m.ts 1272ms 6.8ms 252.6MB 2260ms 147ms deno 2.1.1

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 74ms 2.0ms 5.5MB 63ms 0ms nim 2.2.0
nim 2.nim 92ms 0.7ms 5.8MB 80ms 0ms nim/clang 2.2.0
typescript 1.ts 128ms 1.8ms 83.2MB 130ms 23ms deno 2.1.1

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 1340ms 11ms 90.8MB 1380ms 47ms deno 2.1.1
nim 1.nim timeout 0.0ms 545.4MB 2357ms 2193ms nim 2.2.0
nim 1.nim timeout 0.0ms 551.8MB 2537ms 2003ms nim/clang 2.2.0

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 149ms 3.6ms 74.9MB 130ms 20ms deno 2.1.1
nim 1.nim 4418ms 16ms 518.6MB 2217ms 1770ms nim/clang 2.2.0
nim 1.nim 4562ms 68ms 518.3MB 2183ms 1947ms nim 2.2.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 184ms 1.3ms 1.5MB 167ms 0ms nim 2.2.0
nim 2.nim 240ms 1.8ms 1.6MB 223ms 3ms nim/clang 2.2.0
nim 1.nim 570ms 2.7ms 1.8MB 447ms 107ms nim/clang 2.2.0
nim 1.nim 597ms 3.2ms 1.5MB 463ms 113ms nim 2.2.0
typescript 1.ts 2087ms 21ms 60.1MB 1923ms 170ms deno 2.1.1

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 20ms 0.2ms 1.5MB 10ms 0ms nim 2.2.0
nim 2.nim 26ms 0.5ms 1.8MB 17ms 0ms nim/clang 2.2.0
nim 1.nim 60ms 0.8ms 1.8MB 43ms 3ms nim/clang 2.2.0
nim 1.nim 63ms 1.4ms 1.5MB 40ms 10ms nim 2.2.0
typescript 1.ts 254ms 9.1ms 61.0MB 233ms 23ms deno 2.1.1

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 1.1ms 0.0ms 1.6MB 0ms 0ms nim 2.2.0
nim 1.nim 1.2ms 0.0ms 1.8MB 0ms 0ms nim/clang 2.2.0
typescript 1.ts 29ms 3.2ms 48.3MB 10ms 6ms deno 2.1.1

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 688ms 3.1ms 219.1MB 577ms 443ms deno 2.1.1
typescript 2.ts 691ms 4.9ms 218.6MB 573ms 450ms deno 2.1.1
typescript 1-http2.ts 876ms 13ms 216.3MB 807ms 390ms deno 2.1.1
nim 1.nim 991ms 19ms 99.5MB 300ms 667ms nim/clang 2.2.0
nim 1.nim 1006ms 7.9ms 98.3MB 300ms 680ms nim 2.2.0
typescript 2-tls.ts 1429ms 11ms 240.8MB 1237ms 517ms deno 2.1.1

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 160ms 3.1ms 18.4MB 23ms 117ms nim/clang 2.2.0
nim 1.nim 165ms 1.2ms 17.8MB 47ms 103ms nim 2.2.0
typescript 1.ts 205ms 2.2ms 97.3MB 140ms 87ms deno 2.1.1
typescript 2.ts 207ms 6.9ms 96.7MB 143ms 90ms deno 2.1.1
typescript 1-http2.ts 246ms 5.0ms 99.6MB 200ms 73ms deno 2.1.1
typescript 2-tls.ts 362ms 11ms 101.6MB 247ms 143ms deno 2.1.1

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 165ms 2.5ms 96.0MB 157ms 37ms deno 2.1.1

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 1212ms 3.4ms 429.9MB 1330ms 140ms deno 2.1.1

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 109ms 1.8ms 1.6MB 100ms 0ms nim/clang 2.2.0
nim 2.nim 114ms 0.9ms 1.4MB 103ms 0ms nim 2.2.0
typescript 2.ts 272ms 5.2ms 66.3MB 260ms 13ms deno 2.1.1
typescript 1.ts 565ms 4.1ms 63.5MB 547ms 10ms deno 2.1.1
nim 1.nim timeout 0.0ms 1.3MB 4990ms 0ms nim 2.2.0
nim 1.nim timeout 0.0ms 1.5MB 4990ms 0ms nim/clang 2.2.0

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 327ms 1.7ms 1.6MB 317ms 0ms nim/clang 2.2.0
nim 2.nim 338ms 0.5ms 1.4MB 330ms 0ms nim 2.2.0
typescript 2.ts 715ms 6.4ms 72.9MB 687ms 33ms deno 2.1.1
typescript 1.ts 1619ms 9.2ms 69.8MB 1590ms 23ms deno 2.1.1
nim 1.nim timeout 0.0ms 1.3MB 4990ms 0ms nim 2.2.0
nim 1.nim timeout 0.0ms 1.5MB 4990ms 0ms nim/clang 2.2.0

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 48ms 0.4ms 1.5MB 40ms 0ms nim/clang 2.2.0
nim 2.nim 52ms 1.2ms 1.3MB 43ms 0ms nim 2.2.0
typescript 2.ts 140ms 3.8ms 62.7MB 130ms 7ms deno 2.1.1
typescript 1.ts 172ms 5.7ms 65.2MB 153ms 10ms deno 2.1.1
nim 1.nim 482ms 3.6ms 1.5MB 473ms 0ms nim/clang 2.2.0
nim 1.nim 492ms 2.8ms 1.3MB 480ms 0ms nim 2.2.0

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 535ms 5.9ms 134.0MB 607ms 73ms deno 2.1.1
nim 1.nim 560ms 7.0ms 34.3MB 537ms 10ms nim 2.2.0
nim 1.nim 621ms 3.8ms 35.2MB 603ms 3ms nim/clang 2.2.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 121ms 0.9ms 9.6MB 110ms 0ms nim 2.2.0
nim 1.nim 136ms 12ms 9.9MB 120ms 0ms nim/clang 2.2.0
typescript 1.ts 162ms 2.1ms 100.6MB 150ms 47ms deno 2.1.1

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 319ms 3.9ms 1.8MB 310ms 0ms nim 2.2.0
nim 2.nim 339ms 0.3ms 2.0MB 330ms 0ms nim/clang 2.2.0
typescript 6.ts 461ms 1.6ms 57.9MB 447ms 3ms deno 2.1.1

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 35ms 0.2ms 1.8MB 27ms 0ms nim 2.2.0
nim 2.nim 37ms 0.7ms 2.0MB 30ms 0ms nim/clang 2.2.0
typescript 6.ts 80ms 1.0ms 58.6MB 57ms 13ms deno 2.1.1

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 3.ts timeout 0.0ms 101.3MB 4977ms 33ms deno 2.1.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 3.ts 1295ms 6.5ms 80.8MB 1237ms 80ms deno 2.1.1

secp256k1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 2034ms 174ms 60.4MB 2030ms 17ms deno 2.1.1

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 543ms 36ms 60.2MB 553ms 10ms deno 2.1.1

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 3583ms 7.8ms 1.6MB 3570ms 0ms nim/clang 2.2.0
nim 1.nim 3590ms 8.9ms 1.9MB 3577ms 0ms nim 2.2.0
typescript 7.ts 4244ms 337ms 60.0MB 4223ms 17ms deno 2.1.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 896ms 1.2ms 1.5MB 880ms 0ms nim/clang 2.2.0
nim 1.nim 902ms 3.6ms 1.3MB 893ms 0ms nim 2.2.0
typescript 7.ts 1036ms 5.1ms 58.0MB 1017ms 13ms deno 2.1.1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 226ms 0.3ms 2.0MB 217ms 0ms nim/clang 2.2.0
nim 1.nim 227ms 0.8ms 1.3MB 217ms 0ms nim 2.2.0
typescript 7.ts 287ms 3.2ms 58.4MB 263ms 13ms deno 2.1.1