Skip to content

Instantly share code, notes, and snippets.

@amitpatelx
Last active June 22, 2016 10:49
Show Gist options
  • Save amitpatelx/dd6dd3852257027b099a9961f64ad47e to your computer and use it in GitHub Desktop.
Save amitpatelx/dd6dd3852257027b099a9961f64ad47e to your computer and use it in GitHub Desktop.
Comparing Array#max time between Ruby 2.4.0-preview1 and 2.3.0
2.3.0 :001 > require 'benchmark'
=> true
2.3.0 :002 > x, y = 1, 2;
2.3.0 :003 > puts Benchmark.measure { 10000000.times { [x, y].max } }
3.300000 0.000000 3.300000 ( 3.301698)
=> nil
2.4.0-preview1 :001 > require 'benchmark'
=> true
2.4.0-preview1 :002 > x, y = 1, 2;
2.4.0-preview1 :003 > puts Benchmark.measure { 10000000.times { [x, y].max } }
0.560000 0.000000 0.560000 ( 0.570256)
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment