Here are thorough benchmarks of Crystal and C up against other interpreted languages: https://github.com/kostya/jit-benchmarks . It has other examples besides Fibonacci.
Ruby vs. Crystal Performance
11–20 of 151 posts
Re: Ruby vs. Crystal Performance
#12What’s the elevator pitch on Crystal? Seems like typed Ruby with performance considerations.
More here:
Re: Ruby vs. Crystal Performance
#13What’s the elevator pitch on Crystal? Seems like typed Ruby with performance considerations.
I believe that now they're trying to reduce marketing that relies on Ruby and present more as an independent language (which it is).
Re: Ruby vs. Crystal Performance
#14Here are thorough benchmarks of Crystal and C up against other interpreted languages: https://github.com/kostya/jit-benchmarks . It has other examples besides Fibonacci.
Re: Ruby vs. Crystal Performance
#15> 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.
Re: Ruby vs. Crystal Performance
#16Earlier quoted context omitted.
I mean it's kinda trivial but it does have the added benefit of also showing off that it's statically typed. For a more real world example check out the website of Kemal (Crystals Sinatra equivalent) at https://kemalcr.com/ , where it benchmarks at ~46k requests per second in a HTTP benchmark vs 4k in Ruby.
Or something like Sidekiq in Crystal [1], which was 7 times faster. But now I wonder how much faster would Sidekiq run on TuffleRuby. [1] https://github.com/mperham/sidekiq.cr
Re: Ruby vs. Crystal Performance
#17This 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 t…
Re: Ruby vs. Crystal Performance
#18What’s the elevator pitch on Crystal? Seems like typed Ruby with performance considerations.
Re: Ruby vs. Crystal Performance
#19This 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 t…
You may want to edit the link.
Re: Ruby vs. Crystal Performance
#20The recursively written Fibonacci benchmark is terrible for comparing a interpreted language to a compiled language. When compiling with optimizations in C, for example, the compiler significantly transforms the program. [1] It's possible Crystal does too. [1] https://godbolt.org/z/vaESBG
Recursive fibonacci is highly artificial, but the fact that a compiler can greatly transform the program is an important advantage of compilers over interpreters.