Crystal VS V benchmarks

Current benchmark data was generated on Mon Oct 03 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
v 1.v 1081ms 4.2ms 37.1MB 1060ms 10ms v/clang+gc 0.3.1
v 1.v 1096ms 11ms 37.1MB 1080ms 3ms v/clang 0.3.1
crystal 1.cr 1532ms 4.2ms 64.5MB 1837ms 13ms crystal 1.5.1

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 112ms 1.5ms 5.6MB 100ms 0ms v/clang+gc 0.3.1
v 1.v 113ms 1.2ms 5.5MB 100ms 0ms v/clang 0.3.1
crystal 1.cr 132ms 0.9ms 11.1MB 133ms 3ms crystal 1.5.1

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 1933ms 16ms 20.5MB 1897ms 23ms crystal 1.5.1
v 1.v timeout 0.0ms 0.0MB 0ms 0ms v/clang 0.3.1
v 1.v timeout 0.0ms 0.0MB 0ms 0ms v/clang+gc 0.3.1

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 108ms 3.8ms 9.3MB 97ms 0ms crystal 1.5.1
v 1-m.v 1954ms 19ms 20.4MB 1920ms 1750ms v/clang+gc 0.3.1
v 1.v timeout 0.0ms 0.0MB 0ms 0ms v/clang 0.3.1

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 83ms 1.3ms 7.4MB 73ms 0ms crystal 1.5.1
v 1.v timeout 0.0ms 0.0MB 0ms 0ms v/clang+gc 0.3.1

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 31ms 1.0ms 5.2MB 20ms 0ms crystal 1.5.1
v 1.v timeout 0.0ms 0.0MB 0ms 0ms v/clang+gc 0.3.1

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 3320ms 3.6ms 2.0MB 3310ms 0ms v/clang+gc 0.3.1
v 1.v 3348ms 2.4ms 2.1MB 3337ms 0ms v/clang 0.3.1
crystal 1.cr 3968ms 1.9ms 4.9MB 3953ms 0ms crystal 1.5.1

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 278ms 1.5ms 2.1MB 270ms 0ms v/clang+gc 0.3.1
v 1.v 283ms 2.8ms 2.0MB 270ms 0ms v/clang 0.3.1
crystal 1.cr 323ms 1.9ms 3.0MB 310ms 0ms crystal 1.5.1

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 569ms 0.9ms 2.2MB 553ms 0ms v/clang+gc 0.3.1
v 1.v 569ms 1.7ms 2.2MB 553ms 0ms v/clang 0.3.1
crystal 2.cr 860ms 0.8ms 3.6MB 753ms 93ms crystal 1.5.1
crystal 1.cr 1071ms 23ms 14.7MB 917ms 137ms crystal 1.5.1

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 60ms 0.6ms 2.2MB 50ms 0ms v/clang+gc 0.3.1
v 1.v 62ms 3.2ms 2.3MB 50ms 0ms v/clang 0.3.1
crystal 2.cr 91ms 2.6ms 3.6MB 67ms 7ms crystal 1.5.1
crystal 1.cr 110ms 0.6ms 6.4MB 87ms 10ms crystal 1.5.1

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 2.1ms 0.2ms 2.0MB 0ms 0ms v/clang+gc 0.3.1
v 1.v 2.6ms 0.6ms 2.0MB 0ms 0ms v/clang 0.3.1
crystal 1.cr 3.0ms 0.8ms 3.1MB 0ms 0ms crystal 1.5.1

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 3452ms 67ms 120.4MB 307ms 273ms crystal 1.5.1

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 1170ms 104ms 35.0MB 43ms 40ms crystal 1.5.1

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 0-unsafe.cr 61ms 0.1ms 3.1MB 50ms 0ms crystal 1.5.1
crystal 1.cr 108ms 3.9ms 3.1MB 100ms 0ms crystal 1.5.1
v 1.v 418ms 0.4ms 2.2MB 410ms 0ms v/clang+gc 0.3.1
v 1.v 427ms 0.4ms 2.3MB 420ms 0ms v/clang 0.3.1

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 0-unsafe.cr 174ms 1.0ms 3.1MB 163ms 0ms crystal 1.5.1
crystal 1.cr 312ms 1.1ms 5.0MB 300ms 0ms crystal 1.5.1
v 1.v 1248ms 2.5ms 2.2MB 1240ms 0ms v/clang+gc 0.3.1
v 1.v 1278ms 1.8ms 2.3MB 1267ms 0ms v/clang 0.3.1

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 0-unsafe.cr 30ms 0.9ms 3.1MB 20ms 0ms crystal 1.5.1
crystal 1.cr 55ms 0.8ms 3.1MB 47ms 0ms crystal 1.5.1
v 1.v 136ms 0.8ms 2.3MB 127ms 0ms v/clang+gc 0.3.1
v 1.v 141ms 0.8ms 2.2MB 130ms 0ms v/clang 0.3.1

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 427ms 0.7ms 5.0MB 413ms 0ms v/clang+gc 0.3.1
v 1.v 436ms 1.0ms 8.4MB 423ms 0ms v/clang 0.3.1
crystal 1.cr 995ms 1.1ms 7.5MB 980ms 0ms crystal 1.5.1

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 21ms 0.7ms 2.2MB 10ms 0ms v/clang+gc 0.3.1
v 1.v 21ms 1.1ms 2.3MB 10ms 0ms v/clang 0.3.1
crystal 1.cr 46ms 0.8ms 6.5MB 40ms 0ms crystal 1.5.1

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 1058ms 30ms 66.1MB 1223ms 13ms crystal 1.5.1

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 202ms 6.2ms 17.5MB 213ms 7ms crystal 1.5.1

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 509ms 0.5ms 4.9MB 500ms 0ms crystal 1.5.1
crystal 2.cr 541ms 1.0ms 3.0MB 530ms 0ms crystal 1.5.1
v 1.v 1041ms 44ms 2.3MB 1030ms 0ms v/clang+gc 0.3.1
v 1.v 1070ms 92ms 2.3MB 1053ms 0ms v/clang 0.3.1

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 55ms 0.9ms 3.1MB 47ms 0ms crystal 1.5.1
crystal 2.cr 60ms 2.6ms 2.9MB 50ms 0ms crystal 1.5.1
v 1.v 104ms 0.2ms 2.4MB 93ms 0ms v/clang+gc 0.3.1
v 1.v 105ms 0.3ms 2.3MB 93ms 0ms v/clang 0.3.1

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 2.cr 468ms 0.8ms 8.0MB 457ms 0ms crystal 1.5.1
v 2.v 500ms 1.7ms 10.6MB 487ms 0ms v/clang 0.3.1
v 2.v 501ms 2.9ms 10.5MB 487ms 0ms v/clang+gc 0.3.1
v 1.v 646ms 4.7ms 41.2MB 627ms 3ms v/clang+gc 0.3.1
v 1.v 653ms 36ms 41.2MB 637ms 0ms v/clang 0.3.1
crystal 1.cr 726ms 51ms 44.8MB 703ms 3ms crystal 1.5.1

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 2.cr 109ms 0.9ms 6.4MB 90ms 0ms crystal 1.5.1
v 1.v 115ms 1.4ms 19.0MB 100ms 0ms v/clang+gc 0.3.1
v 2.v 116ms 0.4ms 3.3MB 110ms 0ms v/clang 0.3.1
v 1.v 116ms 0.9ms 19.5MB 100ms 0ms v/clang 0.3.1
v 2.v 116ms 0.3ms 3.3MB 100ms 0ms v/clang+gc 0.3.1
crystal 1.cr 151ms 0.5ms 14.9MB 140ms 0ms crystal 1.5.1

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 2755ms 38ms 6.8MB 3000ms 277ms crystal 1.5.1
v 1.v 4729ms 31ms 3.3MB 4703ms 3ms v/clang+gc 0.3.1
v 1.v timeout 0.0ms 0.0MB 0ms 0ms v/clang 0.3.1
v 2.v timeout 0.0ms 0.0MB 0ms 0ms v/clang+gc 0.3.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 639ms 4.2ms 7.2MB 660ms 73ms crystal 1.5.1
v 1.v 1153ms 23ms 2.7MB 1140ms 0ms v/clang+gc 0.3.1
v 2.v 1457ms 5.6ms 3.1MB 1447ms 0ms v/clang+gc 0.3.1
v 1.v 1621ms 74ms 3.0MB 1600ms 3ms v/clang 0.3.1

regex-redux

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 2465ms 3.9ms 195.7MB 2400ms 50ms crystal 1.5.1
v 1.v timeout 0.0ms 0.0MB 0ms 0ms v/clang+gc 0.3.1

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 254ms 1.5ms 22.9MB 233ms 3ms crystal 1.5.1
v 1.v 4360ms 13ms 26.1MB 4340ms 3ms v/clang+gc 0.3.1

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 4120ms 0.8ms 2.8MB 4110ms 0ms v/clang 0.3.1
v 1.v 4121ms 0.4ms 2.9MB 4110ms 0ms v/clang+gc 0.3.1
crystal 1.cr timeout 0.0ms 0.0MB 0ms 0ms crystal 1.5.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 1033ms 0.5ms 2.6MB 1017ms 0ms v/clang+gc 0.3.1
v 1.v 1034ms 1.3ms 2.6MB 1023ms 0ms v/clang 0.3.1
crystal 1.cr 1510ms 2.7ms 5.9MB 1497ms 0ms crystal 1.5.1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
v 1.v 261ms 0.6ms 2.6MB 250ms 0ms v/clang+gc 0.3.1
v 1.v 261ms 0.6ms 2.6MB 250ms 0ms v/clang 0.3.1
crystal 1.cr 381ms 0.4ms 5.6MB 370ms 0ms crystal 1.5.1