Is Ruby 2.3 Faster? No Significant Improvement In Rails Applications
Ruby 2.3 was released in December 2015 with yet another bunch of performance improvements. But is it really faster than 2.2? Let's take a look.
This is the sixth and, most likely, last post in my series about Ruby 2.3 performance. We'll see whether upgrading the real world Rails apps from Ruby 2.2 to 2.3 improves performance. Spoiler alert: it does not.
I was concerned that Ruby is actually getting faster. Looks like there is no reason to worry. Rails/Ruby expert who switched to Phoenix/Elixir
I still remember how big of an improvement Ruby 2.1 was. Startup time was reduced tenfold. Performance tests reported a minimum of 15% speedup. New Relic request time and memory usage metrics went sharply down.
So I was eager to upgrade my production Rails apps to Ruby 2.3 and measure the performance.
Here's what I got. In the table below you'll see some of the performance benchmarks for Acunote, the online project management system:
|Benchmark||Ruby 2.2.3||Ruby 2.3.0|
|Benchmark Burndown 120||0.82 ± 0.00||0.86 ± 0.00|
|Benchmark Sprint 20 x (1+5) (C)||0.24 ± 0.00||0.24 ± 0.00|
|Benchmark Analyze 20 x (1+5)||1.78 ± 0.02||1.80 ± 0.03|
|Benchmark Task Details Page||0.39 ± 0.01||0.38 ± 0.00|
|Benchmark Signup||0.30 ± 0.00||0.29 ± 0.00|
|Benchmark Copy 120||1.48 ± 0.02||1.42 ± 0.02|
|Benchmark Import 71||2.08 ± 0.00||1.99 ± 0.03|
|Benchmark Set Field (EP)||0.18 ± 0.00||0.17 ± 0.01|
The table is incomplete. I have about 60 benchmarks for Acunote, but only the two highlighted ones demonstrated an improvement in the statistically significant way.
Copy 120 benchmark is heavy on rendering, and
Import 71 is heavy on garbage collector. Both got 4% faster.
For another application I didn't have the performance tests, but I had New Relic:
Do you see improvement? I don't. Neither for this one, nor for my other applications.
Verdict: Not Significantly Faster
It turns out Ruby 2.3 is not significantly faster than 2.2. Best improvement I got was a meager 4% speedup in rendering-heavy and memory-heavy benchmarks.
Note, I upgraded only 5 Rails applications. That is all I have at the moment. If you upgraded to Ruby 2.3 and got a significant increase in performance, please let me know. I'm eager to hear about it!
Read More On Ruby 2.3 Performance
I investigated the effect of various specific improvements in Ruby 2.3 on performance before writing this post. Take a look, you might find something relevant to you.
- Nested Iterator Performance
- Date Parsing Performance
- Rails ERB Template Rendering Performance
- Immutable (Frozen) String Literals Performance
- How to Prepare Yourself for Frozen String Literals and Not Lose Performance
Want to learn more about the Ruby performance optimization? Curious about performance profiling, benchmarking, and testing? Read that in my book:
|Next:||$6 Discount on Ruby Performance Optimization Book (Paperback) Today on Amazon|
|Previous:||Is Ruby 2.3 Faster? How to Prepare Yourself for Frozen String Literals and Not Lose Performance|