Ruby out performs Crystal significantly on this numerical algorithm

I built the executable with the `crystal build --release" command. I am sure of that.
And I just checked it on another PC. The time is still almost the same.

I had a similar situation before. At that time, most of the time was consumed by the bound library.
Let’s take a profile to investigate the performance of Crystal’s code.


I am not at all familiar with static languages, so the only time I run the profiler is to examine Crystal. However, looking at the diagram, it appears that the external library libgmp.so is consuming most of the program execution time. Therefore, it is quite possible that the same time is consumed whether it is Ruby or Crystal. In other words, it may not be very appropriate as a benchmark for the language itself.

4 Likes