Sha256: 835509dcf04fde627c9147480ecf3a7ddd00a92b55ea11bc98734bb40174794a

Contents?: true

Size: 343 Bytes

Versions: 6

Compression:

Stored size: 343 Bytes

Contents

#!/usr/bin/env ruby

require 'benchmark/ips'

Benchmark.ips do |x|

  # Use bootstrap confidence intervals
  x.stats = :bootstrap

  # Set confidence to 95%
  x.confidence = 95

  # Run multiple iterations for better warmup
  x.iterations = 3

  x.report("mul") { 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 }
  x.report("pow") { 2 ** 8 }

  x.compare!
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
benchmark-ips-2.14.0 examples/advanced.rb
benchmark-ips-2.13.0 examples/advanced.rb
benchmark-ips-2.12.0 examples/advanced.rb
benchmark-ips-2.11.0 examples/advanced.rb
benchmark-ips-2.10.0 examples/advanced.rb
benchmark-ips-2.9.3 examples/advanced.rb