219 points · by teeray · 12y ago · 51 comments
Pretty graphs here: http://www.isrubyfastyet.com/ (I run a nightly benchmark.)
I will add 2.1.0 right now and hopefully we will have confirmed data in the morning.
EDIT: You mention 20% improvement on Rake tasks. Simple Rake tasks are dominated by Rails' startup time. My benchmark reads about a 15% improvement in startup time, which agrees with what you are saying.
However, the 1.9 series was a significant step back from 1.8.7 for out-of-the-box Rails startup time. Ruby 2.0.0 pretty much matched Ruby 1.8.7. Now with 2.1.0, Ruby is finally categorically faster than 1.8.7 for starting Rails. (Rails itself has also made improvements; but my benchmark has been locked at Rails 3.1.3)
And, you were right, I put Ruby 2.1.0 live on one of my web apps last night, and didn't really get any kind of significant speed boost, what I did get was a significant decrease in garbage collection. here's the new relic graph, ruby 2.1.0 went live at 17:45 on the chart https://cloudup.com/ifosPh4rX4v
Running with a more modern VM might yield better results.
A micro-benchmark suite is better than a few micro-benchmarks, but really I would like a suite of real-world micro-applications.
I'm willing to add more benchmarks so it's not just Rails, but I simply don't know what to add.
String#scrub: https://github.com/ruby/ruby/blob/1e8a05c1dfee94db9b6b825097...
String#freeze example:
For those who need #scrub behavior in ruby 1.9 or 2.0, I wrote a gem a while ago to do this -- I wrote it before I was aware of the upcoming String#scrub api -- I'll maybe change it to provide a String#scrub 'backfill' now, with monkey patching even?
(It was for a tiny weekend project where I was reading logs from the ZNC IRC bouncer to present a nice web UI for them, for some reason sometimes there were invalid characters and I didn't really understand why - possible that I was just reading them with the wrong input encoding but I think I tried a few different ones.)
It was mentioned in the changelog.
It won't take many lines of pure ruby code to do it for ruby 1.9 too, although presumably not performing quite as well as a C version.
At any rate, this is definitely something I and people I know need to do all the time, although apparently most ruby devs never need to do it; but I'm glad it's finally made it into stdlib.
I've completed a pure-ruby polyfill that should work on 1.9 as well as 2.0, any ruby interpreter including jruby. (It does have some issues mentioned in the readme).
Ruby 2.0-p353
Transactions: 934 hits Availability: 100.00 % Elapsed time: 76.66 secs Data transferred: 0.43 MB Response time: 3.19 secs Transaction rate: 12.18 trans/sec Throughput: 0.01 MB/sec Concurrency: 38.92 Successful transactions: 934 Failed transactions: 0 Longest transaction: 3.93 Shortest transaction: 0.67
Ruby 2.1 Transactions: 1136 hits Availability: 100.00 % Elapsed time: 76.41 secs Data transferred: 0.53 MB Response time: 2.64 secs Transaction rate: 14.87 trans/sec Throughput: 0.01 MB/sec Concurrency: 39.30 Successful transactions: 1136 Failed transactions: 0 Longest transaction: 3.18 Shortest transaction: 0.56
Now i am waiting for someone doing some benchmarks with the two ( & JRuby ).
http://svn.ruby-lang.org/repos/ruby/branches/ruby_2_1/
while there are branchs such as ruby_1_9_3 and ruby_2_0_0.Merry Xmas.
There's a world of difference when something is unsigned because it's impossible to prove that it was what the developer(s) signed off to release.
=> :foo
2.1.0p0 :002 > def eval_it_now_bitch! lulz
2.1.0p0 :003?> eval lulz.to_s
2.1.0p0 :004?> end
=> :eval_it_now_bitch!
2.1.0p0 :005 > eval_it_now_bitch! x
hello
=> nil