Crystal VS Wasm benchmarks

Current benchmark data was generated on Mon Dec 30 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
crystal 1.cr 1344ms 19ms 64.2MB 1317ms 10ms crystal 1.14.0
wasm 5.rs 1721ms 55ms 34.9MB 1707ms 0ms wasmtime 28.0.0
wasm 3.rs 1751ms 19ms 52.9MB 1727ms 13ms wasmtime 28.0.0
wasm 4.rs 1758ms 1.3ms 34.9MB 1733ms 10ms wasmtime 28.0.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 105ms 3.9ms 11.1MB 93ms 0ms crystal 1.14.0
wasm 3.rs 169ms 2.4ms 22.9MB 153ms 3ms wasmtime 28.0.0
wasm 5.rs 170ms 5.5ms 21.0MB 157ms 3ms wasmtime 28.0.0
wasm 4.rs 172ms 2.6ms 21.2MB 157ms 0ms wasmtime 28.0.0

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 3.rs 1113ms 2.9ms 22.9MB 1097ms 3ms wasmtime 28.0.0
crystal 1.cr 1293ms 57ms 20.1MB 1223ms 53ms crystal 1.14.0

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 74ms 0.3ms 7.5MB 47ms 7ms crystal 1.14.0
wasm 3.rs 79ms 2.1ms 21.3MB 70ms 0ms wasmtime 28.0.0

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 61ms 1.6ms 7.0MB 40ms 7ms crystal 1.14.0
wasm 1.rs 417ms 4.0ms 22.3MB 400ms 7ms wasmtime 28.0.0

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 23ms 0.8ms 5.4MB 10ms 0ms crystal 1.14.0
wasm 1.rs 115ms 2.4ms 21.7MB 97ms 3ms wasmtime 28.0.0

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 2489ms 19ms 3.0MB 2480ms 0ms crystal 1.14.0
wasm 1.rs 4181ms 12ms 20.6MB 4163ms 0ms wasmtime 28.0.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 205ms 2.6ms 3.0MB 190ms 0ms crystal 1.14.0
wasm 1.rs 355ms 3.4ms 18.7MB 347ms 0ms wasmtime 28.0.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 234ms 1.6ms 19.0MB 220ms 0ms wasmtime 28.0.0
crystal 2.cr 543ms 3.5ms 3.4MB 413ms 110ms crystal 1.14.0
crystal 1.cr 731ms 4.9ms 14.7MB 607ms 107ms crystal 1.14.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 31ms 0.9ms 19.0MB 23ms 0ms wasmtime 28.0.0
crystal 2.cr 58ms 1.3ms 3.4MB 33ms 13ms crystal 1.14.0
crystal 1.cr 77ms 0.9ms 4.5MB 50ms 13ms crystal 1.14.0

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 2.0ms 0.2ms 3.0MB 0ms 0ms crystal 1.14.0
wasm 1.rs 6.6ms 0.3ms 19.5MB 0ms 0ms wasmtime 28.0.0

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 2161ms 211ms 185.4MB 267ms 507ms crystal 1.14.0

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 1160ms 106ms 54.0MB 23ms 90ms crystal 1.14.0

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 0-unsafe.cr 36ms 1.6ms 3.1MB 27ms 0ms crystal 1.14.0
crystal 1.cr 65ms 2.3ms 3.1MB 53ms 0ms crystal 1.14.0
wasm 1.rs 81ms 0.4ms 19.2MB 67ms 3ms wasmtime 28.0.0

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 0-unsafe.cr 99ms 1.9ms 3.1MB 90ms 0ms crystal 1.14.0
crystal 1.cr 190ms 11ms 3.1MB 180ms 0ms crystal 1.14.0
wasm 1.rs 229ms 3.4ms 18.8MB 213ms 0ms wasmtime 28.0.0

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 0-unsafe.cr 18ms 1.3ms 3.0MB 10ms 0ms crystal 1.14.0
crystal 1.cr 30ms 1.6ms 3.0MB 20ms 0ms crystal 1.14.0
wasm 1.rs 44ms 0.4ms 19.2MB 30ms 0ms wasmtime 28.0.0

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 312ms 1.6ms 9.2MB 300ms 0ms crystal 1.14.0
wasm 8.rs 811ms 2.9ms 24.1MB 797ms 0ms wasmtime 28.0.0

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 18ms 0.5ms 6.3MB 10ms 0ms crystal 1.14.0
wasm 8.rs 42ms 0.4ms 21.2MB 33ms 0ms wasmtime 28.0.0

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 794ms 8.6ms 81.7MB 767ms 13ms crystal 1.14.0
wasm 1.rs 872ms 5.6ms 42.9MB 847ms 17ms wasmtime 28.0.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 164ms 7.9ms 22.3MB 150ms 0ms crystal 1.14.0
wasm 1.rs 194ms 3.6ms 26.9MB 180ms 3ms wasmtime 28.0.0

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 2.cr 341ms 1.2ms 3.4MB 330ms 0ms crystal 1.14.0
crystal 1.cr 343ms 3.1ms 3.4MB 333ms 0ms crystal 1.14.0
wasm 1.rs 399ms 1.0ms 20.8MB 387ms 0ms wasmtime 28.0.0
wasm 2.rs 576ms 0.3ms 18.8MB 563ms 0ms wasmtime 28.0.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 2.cr 37ms 0.3ms 3.4MB 30ms 0ms crystal 1.14.0
crystal 1.cr 37ms 0.7ms 3.4MB 30ms 0ms crystal 1.14.0
wasm 1.rs 47ms 0.6ms 19.0MB 40ms 0ms wasmtime 28.0.0
wasm 2.rs 66ms 0.7ms 18.8MB 57ms 0ms wasmtime 28.0.0

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 330ms 4.0ms 24.1MB 317ms 0ms wasmtime 28.0.0
crystal 2.cr 349ms 5.0ms 8.4MB 333ms 0ms crystal 1.14.0
crystal 1.cr 374ms 7.6ms 62.7MB 360ms 0ms crystal 1.14.0
wasm 1.rs 463ms 4.8ms 60.0MB 443ms 3ms wasmtime 28.0.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 77ms 0.7ms 13.3MB 67ms 0ms crystal 1.14.0
wasm 2.rs 85ms 0.7ms 22.2MB 70ms 3ms wasmtime 28.0.0
crystal 2.cr 86ms 1.2ms 4.6MB 77ms 0ms crystal 1.14.0
wasm 1.rs 97ms 0.4ms 30.7MB 80ms 3ms wasmtime 28.0.0

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 2009ms 29ms 6.5MB 1970ms 23ms crystal 1.14.0
wasm 2.rs 2160ms 1.2ms 21.7MB 2143ms 0ms wasmtime 28.0.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 446ms 7.5ms 5.3MB 430ms 7ms crystal 1.14.0
wasm 2.rs 511ms 0.5ms 21.2MB 500ms 0ms wasmtime 28.0.0

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 3583ms 2.7ms 20.7MB 3567ms 0ms wasmtime 28.0.0
crystal 1.cr 3905ms 37ms 4.6MB 3897ms 0ms crystal 1.14.0
wasm 7.rs 4871ms 7.3ms 19.1MB 4857ms 0ms wasmtime 28.0.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 904ms 2.6ms 18.6MB 890ms 0ms wasmtime 28.0.0
crystal 1.cr 981ms 4.6ms 4.5MB 967ms 0ms crystal 1.14.0
wasm 7.rs 1229ms 3.0ms 20.6MB 1210ms 0ms wasmtime 28.0.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 233ms 1.6ms 20.5MB 223ms 3ms wasmtime 28.0.0
crystal 1.cr 247ms 2.1ms 4.0MB 233ms 0ms crystal 1.14.0
wasm 7.rs 314ms 2.7ms 20.5MB 300ms 0ms wasmtime 28.0.0