Skip to content

Instantly share code, notes, and snippets.

@arn-e
Created October 8, 2012 06:30
Show Gist options
  • Save arn-e/3851031 to your computer and use it in GitHub Desktop.
Save arn-e/3851031 to your computer and use it in GitHub Desktop.
benchark_prime_factors.rb
Benchmark.bmbm do |x|
x.report('prime_factors') do
100.times { prime_factors(9000) }
end
x.report('prime_factors_iterative') do
100.times { prime_factors_iterative(9000) }
end
end
# user system total real
# prime_factors 0.010000 0.000000 0.010000 ( 0.002087)
# prime_factors_iterative 0.000000 0.000000 0.000000 ( 0.001386)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment