Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'zipper'
- require 'benchmark'
- MAX = 5000
- Benchmark.bm do |x|
- x.report "zipper" do
- original = Zipper.make(*(0..MAX).to_a)
- zippers = (0..MAX).map{|i|
- original.next.set(i)
- }
- zippers
- end
- x.report "array" do
- ary = (0..MAX).to_a
- arys = (0..MAX).map {|i|
- item = ary.dup
- item[0] = i
- item
- }
- end
- end
Add Comment
Please, Sign In to add comment