Crystal VS C# benchmarks

Current benchmark data was generated on Thu Jul 13 2023, 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
csharp 1.cs 1238ms 15ms 384.0MB 1173ms 167ms dotnet/aot 7.0.306
csharp 1.cs 1474ms 24ms 397.6MB 1343ms 190ms dotnet 7.0.306
crystal 1.cr 1788ms 5.5ms 64.4MB 1767ms 10ms crystal 1.9.0
csharp 1.cs 2201ms 41ms 104.3MB 2517ms 157ms mono 6.12.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 1.cs 126ms 4.3ms 72.0MB 100ms 23ms dotnet/aot 7.0.306
crystal 1.cr 139ms 2.3ms 11.3MB 127ms 0ms crystal 1.9.0
csharp 1.cs 153ms 0.8ms 44.0MB 137ms 3ms mono 6.12.0
csharp 1.cs 237ms 4.4ms 95.5MB 180ms 33ms dotnet 7.0.306

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 1819ms 61ms 20.4MB 1783ms 17ms crystal 1.9.0
csharp 1-m.cs 4416ms 189ms 106.6MB 7553ms 80ms dotnet 7.0.306
csharp 1.cs timeout 0.0ms 82.8MB 9367ms 53ms dotnet/aot 7.0.306

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 97ms 1.5ms 7.7MB 77ms 10ms crystal 1.9.0
csharp 1-m.cs 349ms 31ms 61.8MB 570ms 27ms dotnet/aot 7.0.306
csharp 1-m.cs 570ms 46ms 84.9MB 930ms 40ms dotnet 7.0.306

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 80ms 0.7ms 7.2MB 63ms 7ms crystal 1.9.0
csharp 1.cs timeout 0.0ms 39.5MB 4970ms 7ms dotnet 7.0.306
csharp 1.cs timeout 0.0ms 22.6MB 4987ms 3ms dotnet/aot 7.0.306

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 29ms 0.7ms 5.4MB 17ms 3ms crystal 1.9.0
csharp 1.cs 1048ms 11ms 19.0MB 1040ms 3ms dotnet/aot 7.0.306
csharp 1.cs 1108ms 13ms 32.8MB 1063ms 7ms dotnet 7.0.306

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 3629ms 9.7ms 2.9MB 3617ms 0ms crystal 1.9.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 298ms 0.3ms 3.0MB 290ms 0ms crystal 1.9.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 5-m.cs 366ms 49ms 57.8MB 560ms 127ms dotnet/aot 7.0.306
csharp 5-m.cs 482ms 25ms 68.6MB 743ms 127ms dotnet 7.0.306
csharp 5-m.cs 482ms 6.9ms 38.3MB 823ms 80ms mono 6.12.0
crystal 2.cr 821ms 5.8ms 3.3MB 710ms 93ms crystal 1.9.0
crystal 1.cr 1041ms 2.4ms 14.8MB 917ms 107ms crystal 1.9.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 5-m.cs 60ms 1.7ms 28.3MB 77ms 17ms dotnet/aot 7.0.306
crystal 2.cr 85ms 0.7ms 3.4MB 73ms 0ms crystal 1.9.0
csharp 5-m.cs 97ms 6.4ms 38.3MB 113ms 37ms mono 6.12.0
crystal 1.cr 108ms 0.1ms 4.7MB 80ms 10ms crystal 1.9.0
csharp 5.cs 108ms 2.9ms 39.9MB 93ms 20ms dotnet 7.0.306

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 2.3ms 0.5ms 3.0MB 0ms 0ms crystal 1.9.0
csharp 1.cs 6.8ms 0.8ms 12.1MB 0ms 0ms dotnet/aot 7.0.306
csharp 1.cs 19ms 0.6ms 25.6MB 10ms 0ms mono 6.12.0
csharp 1.cs 59ms 1.9ms 28.8MB 26ms 2ms dotnet 7.0.306

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 2.cs 882ms 26ms 173.6MB 810ms 410ms dotnet 7.0.306
csharp 1.cs 971ms 36ms 174.6MB 983ms 453ms dotnet 7.0.306
csharp 2-http2.cs 1037ms 83ms 134.0MB 1013ms 103ms dotnet 7.0.306
csharp 2-http3.cs 1211ms 30ms 194.8MB 1430ms 177ms dotnet 7.0.306
crystal 1.cr 3497ms 61ms 192.3MB 360ms 360ms crystal 1.9.0

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 2.cs 482ms 7.7ms 92.2MB 410ms 100ms dotnet 7.0.306
csharp 1.cs 526ms 6.7ms 97.2MB 513ms 137ms dotnet 7.0.306
csharp 2-http2.cs 827ms 18ms 90.8MB 813ms 73ms dotnet 7.0.306
csharp 2-http3.cs 970ms 86ms 107.6MB 913ms 110ms dotnet 7.0.306
crystal 1.cr 1284ms 15ms 52.6MB 47ms 50ms crystal 1.9.0

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 0-unsafe.cr 54ms 0.3ms 3.0MB 50ms 0ms crystal 1.9.0
csharp 2.cs 136ms 0.9ms 10.3MB 130ms 0ms dotnet/aot 7.0.306
crystal 1.cr 143ms 54ms 3.0MB 130ms 0ms crystal 1.9.0
csharp 2.cs 185ms 0.6ms 22.1MB 167ms 3ms mono 6.12.0
csharp 2.cs 200ms 5.5ms 29.6MB 163ms 10ms dotnet 7.0.306
csharp 1.cs 1284ms 2.6ms 73.3MB 1247ms 33ms dotnet/aot 7.0.306
csharp 1.cs 1624ms 6.4ms 90.7MB 1563ms 40ms dotnet 7.0.306
csharp 1.cs 3045ms 55ms 49.5MB 3013ms 23ms mono 6.12.0

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 0-unsafe.cr 213ms 80ms 3.0MB 193ms 0ms crystal 1.9.0
crystal 1.cr 273ms 1.2ms 3.0MB 263ms 0ms crystal 1.9.0
csharp 2.cs 394ms 2.2ms 10.2MB 383ms 0ms dotnet/aot 7.0.306
csharp 2.cs 414ms 2.1ms 29.4MB 383ms 7ms dotnet 7.0.306
csharp 2.cs 504ms 3.4ms 23.4MB 487ms 0ms mono 6.12.0
csharp 1.cs 3944ms 317ms 71.6MB 3903ms 40ms dotnet/aot 7.0.306
csharp 1.cs 4542ms 37ms 89.6MB 4480ms 37ms dotnet 7.0.306
csharp 1.cs timeout 0.0ms 45.7MB 4957ms 37ms mono 6.12.0

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 0-unsafe.cr 29ms 5.2ms 3.0MB 20ms 0ms crystal 1.9.0
crystal 1.cr 49ms 4.2ms 3.1MB 37ms 0ms crystal 1.9.0
csharp 2.cs 73ms 3.2ms 10.1MB 73ms 0ms dotnet/aot 7.0.306
csharp 2.cs 105ms 1.2ms 25.2MB 90ms 3ms mono 6.12.0
csharp 2.cs 129ms 9.9ms 29.4MB 100ms 3ms dotnet 7.0.306
csharp 1.cs 2812ms 8.4ms 64.7MB 2783ms 17ms dotnet/aot 7.0.306
csharp 1.cs 3014ms 39ms 80.1MB 2957ms 33ms dotnet 7.0.306
csharp 1.cs 3185ms 2.8ms 31.4MB 3170ms 0ms mono 6.12.0

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 585ms 11ms 9.8MB 570ms 0ms crystal 1.9.0
csharp 2.cs 730ms 8.6ms 94.3MB 670ms 30ms dotnet 7.0.306
csharp 3.cs 3572ms 81ms 38.6MB 3537ms 3ms dotnet 7.0.306
csharp 1.cs 3945ms 14ms 38.7MB 3907ms 10ms dotnet 7.0.306
csharp 3.cs 4830ms 13ms 19.6MB 4823ms 0ms dotnet/aot 7.0.306
csharp 1.cs timeout 0.0ms 15.4MB 4980ms 3ms dotnet/aot 7.0.306
csharp 1.cs timeout 0.0ms 26.8MB 4977ms 3ms mono 6.12.0

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 29ms 0.2ms 6.9MB 20ms 0ms crystal 1.9.0
csharp 2.cs 128ms 6.6ms 43.0MB 97ms 3ms dotnet 7.0.306
csharp 3.cs 207ms 1.4ms 12.5MB 200ms 0ms dotnet/aot 7.0.306
csharp 1.cs 228ms 1.1ms 35.5MB 187ms 13ms dotnet 7.0.306
csharp 3.cs 230ms 4.3ms 35.9MB 193ms 3ms dotnet 7.0.306
csharp 1.cs 274ms 1.5ms 11.3MB 267ms 0ms dotnet/aot 7.0.306
csharp 1.cs 833ms 0.8ms 26.7MB 820ms 0ms mono 6.12.0

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 2.cs 804ms 26ms 369.6MB 673ms 170ms dotnet/aot 7.0.306
csharp 1.cs 841ms 7.8ms 384.6MB 710ms 183ms dotnet/aot 7.0.306
csharp 2.cs 1026ms 11ms 413.9MB 847ms 167ms dotnet 7.0.306
csharp 1.cs 1047ms 13ms 441.4MB 860ms 210ms dotnet 7.0.306
crystal 1.cr 1237ms 24ms 64.4MB 1210ms 13ms crystal 1.9.0
csharp 1.cs 1681ms 23ms 145.1MB 2023ms 143ms mono 6.12.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 2.cs 158ms 3.1ms 77.3MB 133ms 20ms dotnet/aot 7.0.306
crystal 1.cr 226ms 8.6ms 17.5MB 210ms 0ms crystal 1.9.0
csharp 1.cs 229ms 11ms 197.7MB 147ms 77ms dotnet/aot 7.0.306
csharp 1.cs 309ms 7.0ms 72.1MB 280ms 37ms mono 6.12.0
csharp 1.cs 346ms 2.7ms 200.9MB 237ms 90ms dotnet 7.0.306
csharp 2.cs 369ms 0.4ms 101.9MB 313ms 37ms dotnet 7.0.306

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 9.cs 407ms 0.4ms 29.8MB 380ms 0ms dotnet 7.0.306
crystal 2.cr 450ms 0.3ms 2.9MB 437ms 0ms crystal 1.9.0
crystal 1.cr 468ms 29ms 3.0MB 457ms 0ms crystal 1.9.0
csharp 8.cs 498ms 4.0ms 10.1MB 497ms 0ms dotnet/aot 7.0.306
csharp 8.cs 538ms 1.3ms 25.7MB 503ms 0ms dotnet 7.0.306
csharp 8.cs 1108ms 0.6ms 24.9MB 1093ms 0ms mono 6.12.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 2.cr 48ms 0.1ms 2.9MB 40ms 0ms crystal 1.9.0
crystal 1.cr 48ms 0.8ms 3.0MB 40ms 0ms crystal 1.9.0
csharp 8.cs 57ms 2.2ms 10.1MB 53ms 0ms dotnet/aot 7.0.306
csharp 9.cs 101ms 3.9ms 29.3MB 70ms 3ms dotnet 7.0.306
csharp 8.cs 120ms 8.5ms 29.8MB 77ms 3ms dotnet 7.0.306
csharp 8.cs 133ms 3.3ms 24.9MB 120ms 0ms mono 6.12.0

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 2.cr 458ms 6.2ms 8.0MB 443ms 0ms crystal 1.9.0
crystal 1.cr 604ms 9.8ms 42.6MB 583ms 0ms crystal 1.9.0
csharp 1.cs 620ms 16ms 69.7MB 600ms 13ms dotnet/aot 7.0.306
csharp 1.cs 762ms 8.7ms 86.6MB 740ms 10ms mono 6.12.0
csharp 2.cs 767ms 3.1ms 21.7MB 757ms 0ms dotnet/aot 7.0.306
csharp 2.cs 942ms 5.1ms 38.8MB 900ms 7ms dotnet 7.0.306
csharp 1.cs 1381ms 38ms 86.3MB 1333ms 23ms dotnet 7.0.306
csharp 2.cs 2479ms 43ms 34.3MB 2460ms 3ms mono 6.12.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 2.cr 103ms 0.3ms 4.1MB 90ms 0ms crystal 1.9.0
crystal 1.cr 140ms 4.1ms 13.0MB 127ms 0ms crystal 1.9.0
csharp 1.cs 146ms 4.5ms 29.8MB 140ms 0ms dotnet/aot 7.0.306
csharp 1.cs 185ms 0.9ms 40.7MB 163ms 7ms mono 6.12.0
csharp 2.cs 190ms 2.0ms 15.3MB 187ms 0ms dotnet/aot 7.0.306
csharp 2.cs 272ms 2.7ms 28.1MB 233ms 7ms dotnet 7.0.306
csharp 1.cs 336ms 2.1ms 44.3MB 293ms 13ms dotnet 7.0.306
csharp 2.cs 605ms 1.1ms 25.5MB 583ms 7ms mono 6.12.0

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 2576ms 68ms 6.6MB 2557ms 3ms crystal 1.9.0
csharp 1.cs 4565ms 6.9ms 76.2MB 4533ms 40ms dotnet/aot 7.0.306
csharp 1.cs 4718ms 42ms 98.2MB 4653ms 87ms dotnet 7.0.306

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 583ms 11ms 5.4MB 570ms 0ms crystal 1.9.0
csharp 1.cs 1086ms 9.4ms 75.7MB 1067ms 17ms dotnet/aot 7.0.306
csharp 1.cs 1163ms 10ms 94.9MB 1150ms 40ms dotnet 7.0.306

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 3-m.cs 2524ms 7.5ms 13.7MB 4930ms 0ms dotnet/aot 7.0.306
csharp 3-m.cs 4435ms 37ms 34.9MB 8597ms 10ms dotnet 7.0.306
crystal 1.cr timeout 0.0ms 4.4MB 4983ms 0ms crystal 1.9.0
csharp 3.cs timeout 0.0ms 26.5MB 9777ms 7ms mono 6.12.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 3-m.cs 651ms 2.8ms 8.3MB 1233ms 10ms dotnet/aot 7.0.306
csharp 3-m.cs 1230ms 6.9ms 31.6MB 2307ms 3ms dotnet 7.0.306
crystal 1.cr 1433ms 0.2ms 3.9MB 1423ms 0ms crystal 1.9.0
csharp 3-m.cs 3185ms 152ms 27.8MB 6040ms 0ms mono 6.12.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 3-m.cs 179ms 2.9ms 12.2MB 310ms 7ms dotnet/aot 7.0.306
crystal 1.cr 364ms 0.3ms 4.0MB 350ms 0ms crystal 1.9.0
csharp 3.cs 433ms 78ms 29.7MB 567ms 13ms dotnet 7.0.306
csharp 3-m.cs 802ms 3.6ms 29.7MB 1520ms 7ms mono 6.12.0