Skip to content

Instantly share code, notes, and snippets.

@bethsecor
Created January 20, 2016 05:03
Show Gist options
  • Save bethsecor/f792ce198e69d277781f to your computer and use it in GitHub Desktop.
Save bethsecor/f792ce198e69d277781f to your computer and use it in GitHub Desktop.
require 'better-benchmark'
@data = (1..100).to_a
result = Benchmark.compare_realtime(
:iterations => 30,
:inner_iterations => 500_000,
:warmup_iterations => 1,
:verbose => true
) { |iteration|
@data.shuffle!
}.with { |iteration|
@data.shuffle
}
Benchmark.report_on result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment