Skip to content

Instantly share code, notes, and snippets.

@maxehmookau
Last active December 13, 2016 16:07
Show Gist options
  • Save maxehmookau/ffc5d78d2dbc87a694a276d0fa474c78 to your computer and use it in GitHub Desktop.
Save maxehmookau/ffc5d78d2dbc87a694a276d0fa474c78 to your computer and use it in GitHub Desktop.
require "benchmark"
Benchmark.bmbm do |x|
x.report("min") { (1..10000000).to_a.shuffle.min }
x.report("max") { (1..10000000).to_a.shuffle.max }
end
# Ruby 2.4-rc
user system total real
min 0.750000 0.000000 0.750000 ( 0.756316)
max 0.770000 0.020000 0.790000 ( 0.794998)
# Ruby 2.3
user system total real
min 1.290000 0.070000 1.360000 ( 1.363364)
max 1.150000 0.040000 1.190000 ( 1.186492)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment