Typescript VS C++ benchmarks

Current benchmark data was generated on Tue Apr 01 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
typescript 1.ts 1088ms 10ms 480.2MB 1010ms 223ms deno 2.2.6

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 135ms 8.7ms 76.9MB 133ms 27ms deno 2.2.6

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 1168ms 1.9ms 120.6MB 1160ms 60ms deno 2.2.6

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 147ms 2.8ms 70.7MB 127ms 23ms deno 2.2.6

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 2058ms 7.8ms 57.5MB 1927ms 137ms deno 2.2.6

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 243ms 1.2ms 57.6MB 220ms 27ms deno 2.2.6

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 1.cpp 1.2ms 0.3ms 1.4MB 0ms 0ms g++ 11.4.0
cpp 1.cpp 1.5ms 0.1ms 2.3MB 0ms 0ms clang++ 14.0.0-1ubuntu1.1
typescript 1.ts 26ms 0.6ms 44.5MB 10ms 6ms deno 2.2.6

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1-m.ts 656ms 3.7ms 249.1MB 597ms 437ms deno 2.2.6
typescript 2-m.ts 663ms 7.2ms 233.6MB 607ms 437ms deno 2.2.6
typescript 1-http2.ts 810ms 11ms 243.1MB 737ms 430ms deno 2.2.6
typescript 2-tls.ts 1413ms 16ms 254.0MB 1273ms 523ms deno 2.2.6

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 167ms 1.3ms 89.8MB 117ms 97ms deno 2.2.6
typescript 2.ts 169ms 1.0ms 91.3MB 123ms 97ms deno 2.2.6
typescript 1-http2.ts 209ms 3.9ms 93.3MB 157ms 100ms deno 2.2.6
typescript 2-tls.ts 351ms 18ms 97.0MB 280ms 120ms deno 2.2.6

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 162ms 1.1ms 92.1MB 157ms 33ms deno 2.2.6

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 1194ms 5.4ms 415.5MB 1317ms 147ms deno 2.2.6

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 2.ts 285ms 13ms 61.6MB 270ms 17ms deno 2.2.6
typescript 1.ts 582ms 4.0ms 59.7MB 567ms 10ms deno 2.2.6

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 2.ts 744ms 13ms 69.5MB 730ms 17ms deno 2.2.6
typescript 1.ts 1661ms 6.0ms 66.9MB 1637ms 20ms deno 2.2.6

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 2.ts 142ms 3.0ms 56.8MB 127ms 13ms deno 2.2.6
typescript 1.ts 172ms 2.5ms 59.3MB 160ms 10ms deno 2.2.6

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 562ms 2.9ms 226.1MB 567ms 110ms deno 2.2.6

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 154ms 0.8ms 98.0MB 147ms 37ms deno 2.2.6

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 0-i.cpp 167ms 0.4ms 1.5MB 160ms 0ms g++ 11.4.0
cpp 0-i.cpp 171ms 0.6ms 2.3MB 160ms 0ms clang++ 14.0.0-1ubuntu1.1
cpp 1.cpp 315ms 1.3ms 1.9MB 307ms 0ms g++ 11.4.0
cpp 1.cpp 316ms 0.6ms 2.3MB 310ms 0ms clang++ 14.0.0-1ubuntu1.1
typescript 6.ts 463ms 3.5ms 56.1MB 447ms 10ms deno 2.2.6

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 0-i.cpp 18ms 0.1ms 1.5MB 10ms 0ms g++ 11.4.0
cpp 0-i.cpp 19ms 0.1ms 2.3MB 10ms 0ms clang++ 14.0.0-1ubuntu1.1
cpp 1.cpp 34ms 0.3ms 2.4MB 30ms 0ms clang++ 14.0.0-1ubuntu1.1
cpp 1.cpp 34ms 0.6ms 1.8MB 27ms 0ms g++ 11.4.0
typescript 6.ts 78ms 0.4ms 54.6MB 60ms 10ms deno 2.2.6

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 3.ts timeout 0.0ms 132.4MB 4970ms 57ms deno 2.2.6

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 3.ts 1247ms 11ms 77.1MB 1187ms 77ms deno 2.2.6

secp256k1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 1925ms 0.7ms 57.6MB 1933ms 13ms deno 2.2.6

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 526ms 1.2ms 56.5MB 527ms 13ms deno 2.2.6

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 8-m.cpp 488ms 4.9ms 2.1MB 1897ms 0ms g++ 11.4.0
cpp 8-m.cpp 564ms 132ms 3.5MB 1983ms 13ms clang++ 14.0.0-1ubuntu1.1
cpp 6-im.cpp 922ms 2.4ms 3.4MB 3613ms 0ms clang++ 14.0.0-1ubuntu1.1
cpp 6-im.cpp 923ms 4.1ms 2.1MB 3630ms 0ms g++ 11.4.0
typescript 7.ts 4050ms 12ms 56.5MB 4033ms 10ms deno 2.2.6

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 8-m.cpp 123ms 1.0ms 3.4MB 457ms 0ms clang++ 14.0.0-1ubuntu1.1
cpp 8-m.cpp 130ms 2.4ms 2.0MB 483ms 0ms g++ 11.4.0
cpp 6-im.cpp 239ms 2.5ms 3.4MB 910ms 0ms clang++ 14.0.0-1ubuntu1.1
cpp 6-im.cpp 240ms 2.5ms 2.0MB 917ms 0ms g++ 11.4.0
typescript 7.ts 1038ms 1.2ms 55.9MB 1020ms 7ms deno 2.2.6

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 8-m.cpp 40ms 0.4ms 2.0MB 130ms 0ms g++ 11.4.0
cpp 8-m.cpp 41ms 7.8ms 3.4MB 117ms 0ms clang++ 14.0.0-1ubuntu1.1
cpp 6-im.cpp 66ms 1.0ms 3.4MB 227ms 0ms clang++ 14.0.0-1ubuntu1.1
cpp 6-im.cpp 67ms 0.4ms 2.1MB 240ms 0ms g++ 11.4.0
typescript 7.ts 289ms 4.8ms 53.2MB 270ms 10ms deno 2.2.6