Guest User

Untitled

a guest
Feb 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. require 'benchmark'
  2.  
  3. bigstring = "bigstring" * 100
  4.  
  5. n = 1000000
  6. Benchmark.bm do |x|
  7. x.report("<<") { n.times { bigstring.dup << bigstring << bigstring } }
  8. x.report("+") { n.times { bigstring + bigstring + bigstring } }
  9. end
Add Comment
Please, Sign In to add comment