~ % cat test.rb
puts "Hello, world"
~ % time ruby test.rb
ruby test.rb 0.03s user 0.05s system 25% cpu 0.312 total
~ % time crystal run test.rb
Hello, world
crystal run test.rb 1.48s user 1.09s system 72% cpu 3.559 totalRuby vs. Crystal Performance
31–40 of 151 posts
Re: Ruby vs. Crystal Performance
#32Earlier quoted context omitted.
Care to explain more? Having been using Ruby for about 8 years and Crystal for about 4, they actually have an extremely similar syntax and are also semantically very close. To the point where many Ruby scripts are completely valid Crystal, or at the very least require only a few changes. I do think that people trying to compare Crystal to Ruby kind of miss the point though. Ruby as an interpreted language, even optim…
> Care to explain more? Having been using Ruby for about 8 years and Crystal for about 4, they actually have an extremely similar syntax and are also semantically very close. To the point where many Ruby scripts are completely valid Crystal, or at the very least require only a few changes. It doesn't have Kernel#eval. It doesn't have Kernel#send. It doesn't have Kernel#binding. It doesn't has Proc#binding. It doesn't…
Java and C also share a similar syntax, but that does not make that you can easily swap one for the other.
Re: Ruby vs. Crystal Performance
#33- The syntax is lovely. No, really.
- I hate waiting for it to compile, especially compared to Go's compile time.
- It's really young yet, and the ecosystem is just getting started.
Re: Ruby vs. Crystal Performance
#34Re: Ruby vs. Crystal Performance
#35Here are thorough benchmarks of Crystal and C up against other interpreted languages: https://github.com/kostya/jit-benchmarks . It has other examples besides Fibonacci.
I'm quite surprised to see Javascript / Node so high up the ranks, quite impressive the amount of optimizations that's been done to the engine throughout the years.
Re: Ruby vs. Crystal Performance
#36Earlier quoted context omitted.
Exactly, it's basically statically typed, compiled Ruby with really good performance. Also it has really powerful type inference, which allows you to write really Ruby-like code while maintaining your static typing. The downside of that is that it makes the compiler kind of slow.
Does go-to definition work in crystal? That was always my least favorite thing about ruby, I find it very awkward to write code without being able to jump to definitions.
I don't have the greatest laptop, and run a lot of containers, so Jetbrains IDE's are generally a no-go for me and I stick to VS Code, but trying to develop Ruby/Rails without a Jetbrains IDE Is crippling.
I think ctrl+click definition jump does work in Crystal and it has a decent language server.
Re: Ruby vs. Crystal Performance
#37Re: Ruby vs. Crystal Performance
#38Re: Ruby vs. Crystal Performance
#39Crystal and Ruby do not even remotely have the same semantics. They look similar but the similarity is extremely superficial. The extra semantics that Ruby has have a massive impact on performance, for even the most optimising implementations. This is not a reasonable comparison if you do not consider the 'slick as Ruby' part. No runtime metaprogramming! The entire Ruby ecosystem is built on runtime metaprogramming!…
Re: Ruby vs. Crystal Performance
#40tl;dr "yes, that one is faster and looks similar to the other one so our developers will be less scared and this is good" is important and valid but "that one is just the fast language but slower" is not a valid comparison, which I'm kind of getting.