Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This article by one of the Crystal developers explains why this comparison is not fair: https://crystal-lang.org/2016/07/15/fibonacci-benchmark.html.

> When doing operations between integers, Ruby will make sure to create a Bignum in case of overflow, to give a correct result.

> Now we can understand why Ruby is slower: it has to do this overflow check on every operation, preventing some optimizations. Crystal, on the other hand, can ask LLVM to optimize this code very well, sometimes even letting LLVM compute the result at compile time. However, Crystal might give incorrect results, while Ruby makes sure to always give the correct result.



Since late last year crystal made overflow checking the default (https://crystal-lang.org/2019/09/23/crystal-0.31.0-released....). Dunno how it changed the benchmark.


You may want to edit the link.


Whoops. Thank you!




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: