Typescript VS Wasm 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
typescript 1.ts 1084ms 17ms 459.7MB 1020ms 223ms deno 2.2.6
wasm 5.rs 1797ms 32ms 33.1MB 1777ms 10ms wasmtime 31.0.0
wasm 3.rs 1834ms 21ms 49.1MB 1803ms 20ms wasmtime 31.0.0
wasm 4.rs 1842ms 12ms 33.1MB 1823ms 7ms wasmtime 31.0.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 130ms 2.0ms 77.5MB 130ms 27ms deno 2.2.6
wasm 5.rs 170ms 3.3ms 19.1MB 157ms 0ms wasmtime 31.0.0
wasm 4.rs 181ms 5.1ms 19.2MB 167ms 0ms wasmtime 31.0.0
wasm 3.rs 181ms 5.6ms 21.2MB 167ms 0ms wasmtime 31.0.0

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 3.rs 1124ms 7.2ms 19.6MB 1107ms 0ms wasmtime 31.0.0
typescript 1.ts 1183ms 19ms 121.1MB 1180ms 53ms deno 2.2.6

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 3.rs 82ms 2.5ms 18.2MB 70ms 0ms wasmtime 31.0.0
typescript 1.ts 147ms 1.1ms 70.8MB 127ms 20ms deno 2.2.6

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 237ms 1.7ms 17.2MB 223ms 0ms wasmtime 31.0.0
typescript 1.ts 2073ms 8.5ms 56.1MB 1933ms 150ms deno 2.2.6

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 32ms 0.4ms 17.4MB 20ms 0ms wasmtime 31.0.0
typescript 1.ts 242ms 1.2ms 57.5MB 223ms 23ms deno 2.2.6

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 7.2ms 0.3ms 17.1MB 0ms 0ms wasmtime 31.0.0
typescript 1.ts 27ms 0.4ms 44.2MB 10ms 8ms deno 2.2.6

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 2-m.ts 645ms 6.3ms 232.7MB 607ms 413ms deno 2.2.6
typescript 1-m.ts 659ms 14ms 234.8MB 607ms 437ms deno 2.2.6
typescript 1-http2.ts 812ms 7.3ms 241.8MB 740ms 430ms deno 2.2.6
typescript 2-tls.ts 1461ms 69ms 256.8MB 1293ms 543ms deno 2.2.6

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 2.ts 164ms 3.7ms 89.9MB 123ms 93ms deno 2.2.6
typescript 1.ts 168ms 4.3ms 91.3MB 120ms 100ms deno 2.2.6
typescript 1-http2.ts 209ms 1.1ms 92.9MB 160ms 93ms deno 2.2.6
typescript 2-tls.ts 340ms 4.3ms 98.5MB 267ms 123ms 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 165ms 5.5ms 92.0MB 160ms 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 1213ms 14ms 414.7MB 1327ms 153ms deno 2.2.6

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 90ms 1.4ms 17.4MB 80ms 0ms wasmtime 31.0.0
typescript 2.ts 274ms 1.3ms 61.1MB 267ms 10ms deno 2.2.6
typescript 1.ts 584ms 12ms 59.9MB 567ms 13ms deno 2.2.6

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 258ms 14ms 17.0MB 247ms 0ms wasmtime 31.0.0
typescript 2.ts 739ms 3.9ms 68.6MB 723ms 20ms deno 2.2.6
typescript 1.ts 1675ms 4.5ms 66.6MB 1650ms 20ms deno 2.2.6

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 48ms 0.7ms 16.8MB 40ms 0ms wasmtime 31.0.0
typescript 2.ts 140ms 1.3ms 58.8MB 130ms 10ms deno 2.2.6
typescript 1.ts 171ms 2.9ms 57.2MB 157ms 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 568ms 5.3ms 226.2MB 573ms 110ms deno 2.2.6
wasm 1.rs 887ms 2.5ms 41.3MB 863ms 10ms wasmtime 31.0.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 157ms 1.4ms 98.1MB 157ms 40ms deno 2.2.6
wasm 1.rs 195ms 1.6ms 23.1MB 180ms 0ms wasmtime 31.0.0

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 410ms 2.0ms 17.0MB 400ms 0ms wasmtime 31.0.0
typescript 6.ts 465ms 4.3ms 54.3MB 453ms 10ms deno 2.2.6
wasm 2.rs 581ms 2.6ms 17.0MB 570ms 0ms wasmtime 31.0.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 49ms 1.2ms 17.0MB 37ms 0ms wasmtime 31.0.0
wasm 2.rs 65ms 0.3ms 17.2MB 50ms 0ms wasmtime 31.0.0
typescript 6.ts 78ms 1.6ms 56.2MB 63ms 10ms deno 2.2.6

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 2214ms 13ms 18.1MB 2200ms 0ms wasmtime 31.0.0
typescript 3.ts timeout 0.0ms 130.4MB 4970ms 57ms deno 2.2.6

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 524ms 3.6ms 17.3MB 510ms 0ms wasmtime 31.0.0
typescript 3.ts 1253ms 12ms 77.9MB 1200ms 73ms deno 2.2.6

secp256k1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 1927ms 33ms 57.7MB 1930ms 10ms deno 2.2.6
wasm 1.rs 3616ms 13ms 16.9MB 3603ms 0ms wasmtime 31.0.0

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 526ms 2.3ms 57.8MB 530ms 13ms deno 2.2.6
wasm 1.rs 906ms 2.0ms 17.1MB 890ms 0ms wasmtime 31.0.0

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 3595ms 1.5ms 16.9MB 3580ms 0ms wasmtime 31.0.0
typescript 7.ts 4035ms 5.6ms 54.7MB 4020ms 7ms deno 2.2.6
wasm 7.rs 4901ms 6.9ms 17.1MB 4887ms 0ms wasmtime 31.0.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 907ms 1.5ms 16.9MB 893ms 0ms wasmtime 31.0.0
typescript 7.ts 1036ms 1.0ms 56.0MB 1023ms 7ms deno 2.2.6
wasm 7.rs 1232ms 2.1ms 17.4MB 1220ms 0ms wasmtime 31.0.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 234ms 1.3ms 16.7MB 220ms 0ms wasmtime 31.0.0
typescript 7.ts 286ms 1.5ms 54.5MB 270ms 7ms deno 2.2.6
wasm 7.rs 315ms 0.6ms 16.7MB 300ms 0ms wasmtime 31.0.0