
Raybench – Crystal Programming Language - binki89
http://www.eccentricdevelopments.com/raybench-crystal-plc-pt-13/
======
binki89
In terms of performance, I was able to reduce the computational time from
1m57.812s to 0m30.203s (25.6% of the original time) on my 2.8 GHz 16 GB memory
machine simply by changing each 'class' to a 'struct'. The difference is that
structs are allocated on the stack in Crystal. This is a common performance
optimization in Crystal ([https://crystal-
lang.org/docs/guides/performance.html](https://crystal-
lang.org/docs/guides/performance.html)). For comparison, the Go code, also
listed on the site, ran on my machine in 1m22.466s. I think that with the use
of structs instead of classes, Crystal does run very similar to C speeds.
Otherwise, I really enjoyed this article. The author compares several other
languages with the same benchmark (see
[http://www.eccentricdevelopments.com/programming-language-
co...](http://www.eccentricdevelopments.com/programming-language-comparison-
summary/)). It would be interesting to see D-lang in a future comparison.

