Skip to content
David Hofer edited this page Apr 11, 2016 · 2 revisions

I saw these Julia benchmarks: http://julialang.org/benchmarks/

and thought it would be interesting to implement the same code in Ruby and Crystal:

$ ruby ruby/perf.rb
ruby,fib,1.205366977956146
ruby,parse_int,0.7266300090122968
ruby,mandel,11.557513003936037
ruby,quicksort,5.742206994909793
ruby,pi_sum,644.9551960104145
ruby,rand_mat_stat,7622.015934000956
ruby,rand_mat_mul,39460.20705398405
Gothics:sandbox hofer$ crystal crystal/perf.cr --release
crystal,fib,0.779
crystal,parse_int,0.428
crystal,mandel,0.192
crystal,quicksort,0.798
crystal,pi_sum,0.001
crystal,rand_mat_stat,229.292
crystal,rand_mat_mul,11315.4
Gothics:sandbox hofer$ ruby --version
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
$ crystal --version
Crystal 0.9.1 (Sun Nov 1 18:28:55 UTC 2015)

And for Go: (running the code from here: https://github.com/JuliaLang/julia/blob/master/test/perf/micro/perf.go )

$ go build perf.go
$ ./perf
go,fib,0.0481369452
go,parse_int,0.14828976330000002
go,mandel,0.2028396839
go,quicksort,0.4536509246666667
go,pi_sum,24.590654060000002
go,rand_mat_stat,17.761145869999996
go,rand_mat_mul,64.47849894999999
Gothics:micro hofer$ go version
go version go1.5.1 darwin/amd64

As of 2015-11-03, the Go benchmarks are using OpenBLAS for matrix multiplication, which is highly tuned linear algebra code. I'm working to change the Crystal benchmark to use something similar (https://github.com/mverzilli/crystalla )

Clone this wiki locally