Typescript VS C benchmarks

Current benchmark data was generated on Wed Sep 28 2022, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][2 cores] Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz (Model 106)

* -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 3437ms 95ms 199.6MB 3450ms 577ms deno 1.25.4

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 135ms 1.5ms 50.6MB 130ms 10ms deno 1.25.4

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 1976ms 12ms 71.7MB 1987ms 27ms deno 1.25.4

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 176ms 3.7ms 44.2MB 167ms 0ms deno 1.25.4

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 2116ms 52ms 37.9MB 1977ms 123ms deno 1.25.4

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 272ms 7.2ms 38.2MB 230ms 17ms deno 1.25.4

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 1.c 1.5ms 0.1ms 1.1MB 0ms 0ms clang 11.0.0
c 1.c 1.6ms 0.2ms 1.0MB 0ms 0ms gcc 12.2.0
c 1.c 1.8ms 0.7ms 0.6MB 0ms 0ms zigcc 0.10.0-dev.4192+c75e8f361
typescript 1.ts 29ms 1.1ms 31.2MB 16ms 0ms deno 1.25.4

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 1006ms 4.6ms 136.7MB 1243ms 260ms deno 1.25.4
typescript 2.ts 1038ms 11ms 143.9MB 1280ms 270ms deno 1.25.4
typescript 2-tls.ts 1240ms 8.6ms 150.2MB 1427ms 333ms deno 1.25.4
typescript 1-http2.ts 1607ms 254ms 152.0MB 1467ms 323ms deno 1.25.4

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 2.ts 221ms 14ms 73.1MB 170ms 60ms deno 1.25.4
typescript 1.ts 229ms 11ms 77.0MB 177ms 57ms deno 1.25.4
typescript 1-http2.ts 276ms 35ms 75.8MB 230ms 50ms deno 1.25.4
typescript 2-tls.ts 391ms 11ms 83.2MB 347ms 50ms deno 1.25.4

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 149ms 1.3ms 64.4MB 133ms 17ms deno 1.25.4

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 1137ms 2.5ms 262.4MB 1213ms 97ms deno 1.25.4

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 2.ts 654ms 2.5ms 44.1MB 643ms 7ms deno 1.25.4
typescript 1.ts 1082ms 0.9ms 42.0MB 1067ms 7ms deno 1.25.4

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 2.ts 1896ms 41ms 50.0MB 1873ms 3ms deno 1.25.4
typescript 1.ts 3201ms 39ms 52.7MB 3160ms 10ms deno 1.25.4

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 2.ts 331ms 0.5ms 38.0MB 333ms 0ms deno 1.25.4
typescript 1.ts 374ms 2.8ms 35.7MB 363ms 0ms deno 1.25.4

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 660ms 13ms 90.7MB 667ms 17ms deno 1.25.4

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 210ms 2.6ms 56.5MB 170ms 10ms deno 1.25.4

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 8-i.c 311ms 2.7ms 0.6MB 300ms 0ms zigcc 0.10.0-dev.4192+c75e8f361
c 5.c 320ms 0.3ms 0.9MB 307ms 0ms gcc 12.2.0
c 5.c 328ms 0.6ms 0.6MB 320ms 0ms zigcc 0.10.0-dev.4192+c75e8f361
c 2.c 338ms 0.8ms 0.6MB 330ms 0ms zigcc 0.10.0-dev.4192+c75e8f361
c 8-i.c 347ms 1.6ms 1.1MB 333ms 0ms clang 11.0.0
c 8-i.c 365ms 1.0ms 1.0MB 353ms 0ms gcc 12.2.0
c 5.c 367ms 0.2ms 1.1MB 357ms 0ms clang 11.0.0
c 2.c 407ms 0.8ms 1.1MB 400ms 0ms clang 11.0.0
c 2.c 624ms 0.4ms 1.0MB 610ms 0ms gcc 12.2.0
typescript 6.ts 651ms 14ms 37.4MB 643ms 0ms deno 1.25.4

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 8-i.c 33ms 1.5ms 0.6MB 20ms 0ms zigcc 0.10.0-dev.4192+c75e8f361
c 5.c 35ms 0.5ms 1.0MB 23ms 0ms gcc 12.2.0
c 5.c 35ms 0.3ms 0.6MB 30ms 0ms zigcc 0.10.0-dev.4192+c75e8f361
c 2.c 36ms 0.7ms 0.6MB 30ms 0ms zigcc 0.10.0-dev.4192+c75e8f361
c 8-i.c 38ms 1.0ms 1.1MB 30ms 0ms clang 11.0.0
c 8-i.c 40ms 1.0ms 1.0MB 30ms 0ms gcc 12.2.0
c 5.c 41ms 1.9ms 1.1MB 30ms 0ms clang 11.0.0
c 2.c 45ms 2.0ms 1.1MB 30ms 0ms clang 11.0.0
c 2.c 66ms 0.5ms 1.0MB 57ms 0ms gcc 12.2.0
typescript 6.ts 100ms 1.9ms 37.1MB 90ms 3ms deno 1.25.4

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 3.ts timeout 0.0ms 0.0MB 0ms 0ms deno 1.25.4

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 3.ts 1508ms 6.0ms 57.7MB 1500ms 77ms deno 1.25.4

secp256k1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 2586ms 5.3ms 39.1MB 2590ms 0ms deno 1.25.4

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
typescript 1.ts 686ms 2.4ms 40.6MB 687ms 3ms deno 1.25.4

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 4-m.c 1392ms 2.2ms 2.5MB 2730ms 0ms gcc 12.2.0
c 6-im.c 1599ms 30ms 1.0MB 3113ms 0ms gcc 12.2.0
c 6-im.c 1734ms 20ms 3.0MB 3393ms 3ms clang 11.0.0
c 4-m.c 1741ms 9.5ms 3.1MB 3407ms 3ms clang 11.0.0
c 5-im.c 1867ms 10ms 1.0MB 3633ms 3ms gcc 12.2.0
c 5-im.c 2025ms 2.3ms 3.1MB 3983ms 0ms clang 11.0.0
c 3-m.c 2214ms 16ms 1.0MB 4340ms 0ms gcc 12.2.0
c 3-m.c 2214ms 14ms 3.1MB 4343ms 0ms clang 11.0.0
typescript 7.ts 4863ms 22ms 37.1MB 4830ms 7ms deno 1.25.4

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 4-m.c 361ms 5.9ms 1.0MB 687ms 0ms gcc 12.2.0
c 6-im.c 407ms 2.2ms 1.0MB 780ms 0ms gcc 12.2.0
c 6-im.c 443ms 3.8ms 2.9MB 847ms 0ms clang 11.0.0
c 4-m.c 445ms 2.6ms 2.9MB 853ms 0ms clang 11.0.0
c 5-im.c 473ms 2.2ms 1.0MB 907ms 0ms gcc 12.2.0
c 5-im.c 556ms 53ms 3.2MB 1013ms 0ms clang 11.0.0
c 3-m.c 562ms 3.7ms 1.0MB 1083ms 0ms gcc 12.2.0
c 3-m.c 566ms 5.1ms 3.0MB 1087ms 0ms clang 11.0.0
typescript 7.ts 1251ms 11ms 36.9MB 1227ms 3ms deno 1.25.4

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 4-m.c 98ms 1.2ms 1.0MB 170ms 0ms gcc 12.2.0
c 6-im.c 109ms 0.4ms 1.0MB 200ms 0ms gcc 12.2.0
c 6-im.c 118ms 0.4ms 3.1MB 210ms 0ms clang 11.0.0
c 4-m.c 119ms 1.4ms 2.9MB 210ms 0ms clang 11.0.0
c 5-im.c 129ms 2.7ms 1.0MB 227ms 0ms gcc 12.2.0
c 5-im.c 143ms 3.6ms 3.2MB 250ms 0ms clang 11.0.0
c 3-m.c 150ms 1.3ms 0.9MB 273ms 0ms gcc 12.2.0
c 3-m.c 151ms 2.6ms 3.0MB 273ms 0ms clang 11.0.0
typescript 7.ts 364ms 2.9ms 37.1MB 327ms 3ms deno 1.25.4