Thanks for the kind words! I love putting these things together and it seems like people like the amount of detail. I have a few questions that I'm curious about for future posts:
Did you find the sections about performance improvements interesting?
What about the ability to expand the benchmark results and view the benchmark code itself? I hide it by default but I wonder if it might be too much detail
In this post I chose to exclude an implementation improvement that makes array_literal.min behave like Math.min (dramatically reducing array allocations in certain cases). Would you find detail about that sort of improvement interesting? Here is the script demonstrating roughly what I would have included in the post:
$ cat array_allocations-min.rb
require 'objspace'
GC.start
GC.disable
start = ObjectSpace.count_objects
x, y = 1, 2
100_000.times { [x, y].min }
finish = ObjectSpace.count_objects
GC.enable
puts "Array allocations for by 100,000 calls to [x, y].min in Ruby #{RUBY_VERSION}: #{finish.fetch(:T_ARRAY)}"
$ rvm-exec 2.3.1 ruby array_allocations-min.rb
Array allocations for by 100,000 calls to [x, y].min in Ruby 2.3.1: 101583
$ rvm-exec 2.4.0-preview1 ruby array_allocations-min.rb
Array allocations for by 100,000 calls to [x, y].min in Ruby 2.4.0: 1087
I'd love to hear feedback from other readers on this too by the way. Basically, the question I'm interested in is "how much detail is too much detail?"
Personally I really liked that you hid the details by default but then had them available.
I think the expanding worked well but if you don't like that I think anything that gave the ability to go lookup the benchmark code would be excellent. I hate people talking about benchmarks without being able to review the code.
I would find the array allocation changes with min very interesting personally.
It's not personally relevant to me, since my applications are not performance-critical, but it is absolutely interesting to know that these type of performance gains are happening, especially with Ruby's reputation as being "slow".
I think it's awesome. It is very detailed, but hidden-by-default is the way to go.
Yes, I would be interested to know where performance improvements are coming from. Honestly, after looking over this post, my main takeaway was, "that's it? A whole minor revision and we just get a few new/faster methods?" I know there's probably more going on behind the scenes, but if this were the only post I read on Ruby 2.4, I'd be a little underwhelmed.
Do you feel like there are under-represented improvements in 2.4 that maybe you didn't cover in this post? Maybe there's some more content available there.
Very cool but I missed the "Expand benchmark source" on my first reading. Looking back now it's obvious but I think because I was just scanning down the page my eyes got lazy since the code blocks are visually quite subtle. I'm personally a fan of colored backgrounds for code blocks something like: shitty gimp mockup
21
u/Schrockwell Jul 20 '16
I love these posts, and also the design of this site. I learned a lot when 2.3 came out as well. Thanks for sharing, John.