Typescript VS Crystal benchmarks

Current benchmark data was generated on Thu May 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 1067ms 12ms 466.8MB 997ms 217ms deno 2.3.1
crystal 1.cr 1235ms 5.9ms 64.2MB 1210ms 10ms crystal 1.16.2

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 107ms 1.5ms 11.0MB 93ms 0ms crystal 1.16.2
typescript 1.ts 129ms 2.3ms 78.9MB 127ms 27ms deno 2.3.1

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 1280ms 29ms 118.4MB 1270ms 60ms deno 2.3.1
crystal 1.cr 1514ms 13ms 19.9MB 1450ms 53ms crystal 1.16.2

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 85ms 1.3ms 7.1MB 63ms 10ms crystal 1.16.2
typescript 1.ts 145ms 1.9ms 69.3MB 123ms 23ms deno 2.3.1

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 2.cr 550ms 2.8ms 3.5MB 447ms 90ms crystal 1.16.2
crystal 1.cr 694ms 0.9ms 14.6MB 577ms 103ms crystal 1.16.2
typescript 1.ts 2066ms 6.2ms 56.5MB 1920ms 150ms deno 2.3.1

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 2.cr 58ms 0.8ms 3.6MB 40ms 3ms crystal 1.16.2
crystal 1.cr 75ms 0.4ms 4.9MB 50ms 10ms crystal 1.16.2
typescript 1.ts 242ms 1.8ms 55.8MB 220ms 23ms deno 2.3.1

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 1.9ms 0.1ms 2.9MB 0ms 0ms crystal 1.16.2
typescript 1.ts 26ms 0.2ms 44.4MB 10ms 6ms deno 2.3.1

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 2-m.ts 657ms 9.2ms 237.2MB 603ms 437ms deno 2.3.1
typescript 1-m.ts 659ms 9.6ms 238.0MB 613ms 433ms deno 2.3.1
typescript 1-http2.ts 808ms 1.8ms 228.0MB 747ms 420ms deno 2.3.1
typescript 2-tls.ts 1391ms 24ms 262.6MB 1270ms 497ms deno 2.3.1
crystal 1.cr 2259ms 358ms 211.1MB 313ms 487ms crystal 1.16.2

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 167ms 1.9ms 92.1MB 127ms 90ms deno 2.3.1
typescript 2.ts 167ms 2.8ms 92.6MB 127ms 90ms deno 2.3.1
typescript 1-http2.ts 204ms 1.0ms 94.6MB 153ms 97ms deno 2.3.1
typescript 2-tls.ts 347ms 8.0ms 97.7MB 267ms 123ms deno 2.3.1
crystal 1.cr 1184ms 99ms 54.9MB 33ms 83ms crystal 1.16.2

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 163ms 3.6ms 91.8MB 160ms 30ms deno 2.3.1

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 1181ms 2.5ms 415.6MB 1300ms 143ms deno 2.3.1

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 0-unsafe.cr 37ms 0.6ms 3.0MB 30ms 0ms crystal 1.16.2
crystal 1.cr 65ms 1.4ms 3.0MB 57ms 0ms crystal 1.16.2
typescript 2.ts 274ms 4.0ms 62.8MB 263ms 13ms deno 2.3.1
typescript 1.ts 575ms 2.8ms 59.6MB 557ms 10ms deno 2.3.1

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 0-unsafe.cr 99ms 0.9ms 3.0MB 90ms 0ms crystal 1.16.2
crystal 1.cr 187ms 2.0ms 3.0MB 180ms 0ms crystal 1.16.2
typescript 2.ts 735ms 2.5ms 68.5MB 720ms 20ms deno 2.3.1
typescript 1.ts 1646ms 1.7ms 67.9MB 1620ms 17ms deno 2.3.1

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 0-unsafe.cr 17ms 0.3ms 3.0MB 10ms 0ms crystal 1.16.2
crystal 1.cr 30ms 1.3ms 3.0MB 20ms 0ms crystal 1.16.2
typescript 2.ts 142ms 1.0ms 56.8MB 130ms 13ms deno 2.3.1
typescript 1.ts 168ms 2.6ms 57.0MB 150ms 10ms deno 2.3.1

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 560ms 9.4ms 227.2MB 560ms 110ms deno 2.3.1
crystal 1.cr 846ms 6.4ms 64.2MB 823ms 10ms crystal 1.16.2

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 153ms 3.6ms 96.0MB 150ms 37ms deno 2.3.1
crystal 1.cr 175ms 0.8ms 22.2MB 160ms 0ms crystal 1.16.2

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 343ms 0.7ms 3.3MB 330ms 0ms crystal 1.16.2
crystal 2.cr 344ms 2.9ms 3.3MB 333ms 0ms crystal 1.16.2
typescript 6.ts 469ms 5.6ms 55.9MB 453ms 3ms deno 2.3.1

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 2.cr 37ms 0.5ms 3.3MB 30ms 0ms crystal 1.16.2
crystal 1.cr 38ms 1.1ms 3.3MB 30ms 0ms crystal 1.16.2
typescript 6.ts 77ms 0.2ms 54.1MB 63ms 10ms deno 2.3.1

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 1973ms 67ms 6.3MB 1947ms 17ms crystal 1.16.2
typescript 3.ts 4922ms 34ms 131.3MB 4817ms 147ms deno 2.3.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 457ms 15ms 5.1MB 443ms 0ms crystal 1.16.2
typescript 3.ts 1128ms 5.5ms 78.3MB 1070ms 80ms deno 2.3.1

secp256k1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 1941ms 13ms 56.9MB 1947ms 10ms deno 2.3.1

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 536ms 7.3ms 55.8MB 540ms 10ms deno 2.3.1

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 3764ms 9.2ms 4.6MB 3750ms 0ms crystal 1.16.2
typescript 7.ts 4058ms 51ms 53.9MB 4040ms 10ms deno 2.3.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 950ms 8.9ms 4.4MB 940ms 0ms crystal 1.16.2
typescript 7.ts 1036ms 5.5ms 56.1MB 1023ms 10ms deno 2.3.1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 241ms 2.8ms 3.9MB 230ms 0ms crystal 1.16.2
typescript 7.ts 283ms 1.6ms 52.5MB 267ms 7ms deno 2.3.1