The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Is Ruby 2.3 Faster? Date Parsing Performance

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Alexander Dymo

Posts: 24
Nickname: adymo
Registered: Feb, 2004

Alexander Dymo is the author of the Ruby Performance Optimization book
Is Ruby 2.3 Faster? Date Parsing Performance Posted: Feb 9, 2016 12:02 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Alexander Dymo.
Original Post: Is Ruby 2.3 Faster? Date Parsing Performance
Feed Title: Ruby and Rails Performance Optimization
Feed URL: http://ruby-performance-book.com/blog/feed/
Feed Description: This is the blog about Ruby and Rails performance optimization techniques, tips, and tricks. Learn how the newest Ruby releases perform in the field, see how to reduce memory and CPU usage, discover the world of profiling, measuring, and performance testing.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Alexander Dymo
Latest Posts From Ruby and Rails Performance Optimization

Advertisement

Ruby 2.3 was released last month with yet another bunch of performance improvements. But is it really faster than 2.2? Let's take a look.

This is the second post in my series about Ruby 2.3 performance. This time we'll look at date parsing performance.

Date parsing became faster in Ruby 2.3. This is something I came across just today. It was neither announced as an improvement in the changelog, nor there's any indication that Date was optimized.

But the result is apparent. Consider this example:

require 'date'
require 'benchmark'

GC.disable

date = "2014-05-23"
time = Benchmark.realtime do
  100000.times do
    Date.parse(date)
  end
end
puts "%.3f" % time

2.2.3 2.3.0
Date#parse performance 0.928 ± 0.011 s 0.843 ± 0.010 s

On the surface, it is nothing to write home about. 10% speedup that is only visible when parsing dates from the large datasets.

But if you look at the Ruby 2.2 to 2.3 diff, you will not find any optimizations in the Date parsing. It's also not the side-effect of faster garbage collection because I turned that off. So why is it faster then?

I'm yet to dig into details. But I think we can attribute the speedup to the performance improvements in the Ruby VM itself. If you know why exactly it's faster, please let me know.

Verdict: Faster

Date parsing is 10% faster. But it seems that's not the big news. Subtle optimizations in Ruby VM do yield tangible performance improvements. This is something that we see for the first time since Ruby 1.9.3.

Did you like this post? Follow me on Twitter or Google+ to stay updated on Ruby performance optimization news.

Read: Is Ruby 2.3 Faster? Date Parsing Performance

Topic: Is Ruby 2.3 Faster? Rails ERB Template Rendering Performance Previous Topic   Next Topic Topic: Is Ruby 2.3 Faster? Nested Iterator Performance

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use