4 ms·
If someone cares about speed, why would that someone be using Ruby? It feels like optimizing a Ruby program is making "really fast slow code".
by VanillaCafe 12y ago
If someone cares about speed, why would that someone be using Ruby? It feels like optimizing a Ruby program is making "really fast slow code".
- thomasahle 12y agoPerhaps because it's a nice language? Languages are not the same as implementations, and languages are not fast or slow.
- theseoafs 12y agoLanguages are not fast or slow, but languages do have traits that make them more or less well suited to fast or slow implementations. Ruby's semantics do not make it well suited for a fast implementation. That said, the question just becomes "why would you use MRI if you care about performance?"
- nirvdrum 12y agoThe performance profile of an application evolves over time. It can vary not just based on code changes you've made, but also based on how many users you have or how much data they have. This is why libraries should just strive to be fast rather than get hung up on hot paths because hot paths are invariably going to be different for each library user. Taking that a step further, you've started in Ruby, it was fast enough, now you have a performance issue. Your options are: ignore it; make Ruby faster; use a faster idiom; somehow push this off to a C or Java extension; or rewrite in a new language. Rewrites have a spectacular failure rate. Ignoring it is bad for business. Ruby is already implemented in C and Java, so if you're going to go down the extension path to make a core language feature faster, you may as well just make Ruby faster -- it's virtually the same effort. And using faster idioms is just the lowest cost option.