This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
Benchmark.bmbm do |r| | |
NUMBER = 10_000_000 | |
words = %w[apple banana carrot durian pear orange] | |
r.report('zip') do | |
NUMBER.times do | |
words[0..-2].zip(words[1..-1]).all? do |left, right| | |
left <= right | |
end |