Guest User

Untitled

a guest
Feb 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. require 'zipper'
  2. require 'benchmark'
  3.  
  4. MAX = 5000
  5. Benchmark.bm do |x|
  6. x.report "zipper" do
  7. original = Zipper.make(*(0..MAX).to_a)
  8. zippers = (0..MAX).map{|i|
  9. original.next.set(i)
  10. }
  11. zippers
  12. end
  13. x.report "array" do
  14. ary = (0..MAX).to_a
  15. arys = (0..MAX).map {|i|
  16. item = ary.dup
  17. item[0] = i
  18. item
  19. }
  20. end
  21. end
Add Comment
Please, Sign In to add comment