Guest User

Untitled

a guest
Jul 15th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. require 'benchmark'
  2.  
  3. total = (ENV['TOTAL'] || 1000000).to_i
  4.  
  5. Benchmark.bmbm do |x|
  6. x.report("'%d'") do
  7. total.times { sprintf('%d', 10) }
  8. end
  9.  
  10. x.report("'Hello %s, from %4.2f'") do
  11. total.times { sprintf('Hello %s, from %4.2f', 'world', 123.4567) }
  12. end
  13. end
Add Comment
Please, Sign In to add comment