|
Feels like a misleading headline. The author created another templating language alternative to ERB, found that it was slower than ERB, then optimise it until it was roundabout as fast as ERB given a relatively simple template. The author then appears to draw the wrong conclusion: > What I find most interesting about the changes I’ve made to code generation in P2, is that the currently compiled code is more than twice as fast as it was when P2 first came out, which just goes to show than in fact Ruby is not slow, it is actually quite fast, you just need to know how to write fast code! (And I guess this is true for any programming language.) I love Ruby, but it is still a slow language on most benchmarks. That's ok. For most webapps, the bottleneck is not execution-time performance, it's the speed and joy of writing the code. Functionality that never got built because it was too annoying to build is infinitely slow. But there's no point in pretending Ruby, compared to, say, Rust, isn't a slow-as-molasses execution environment. It is. It's ok. It's optimised for developer happiness, not speed. And yes, even so, you can write slow Ruby code and fast Ruby code. Again, which one makes sense is contextual. But it doesn't make the point that "Ruby isn't slow." |
But in my experience it does. I've built platforms in Ruby that handle north of 1K reqs/sec with bursts of 10K reqs/sec on moderate hardware, without needing to setup a whole cluster of machines that crunch on poorly-performing code.
From my experience, getting the average execution time per render from say 0.1ms to 0.01ms, and especially reducing allocations and GC pressure has a big effect on 99% percentiles, and consequently on the cost of compute.
Saying because we use Ruby we don't care if it's slow or not is in a way dismissing it as a viable platform for writing reliable software (because performance is part of reliability).
To me, you can use Ruby to create systems that have very good performance characteristics, and still benefit from developer happiness. The two are not contradictory.