Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

34 lines (29 sloc) 0.755 kb
require 'benchmark'
# Get test data for this benchmark at http://www.tbray.org/tmp/o10k.ap
if (ARGV.size == 0)
puts "Get test data for this benchmark at http://www.tbray.org/tmp/o10k.ap"
exit
end
file = ARGV[0]
5.times {
counts = {}
counts.default = 0
puts Benchmark.measure {
File.open(file) { |f|
f.each_line {|line|
if line =~ %r{GET /ongoing/When/\d\d\dx/(\d\d\d\d/\d\d/\d\d/[^ .]+) }
counts[$1] += 1
end
}
}
}
}
#ARGF.each_line do |line|
# if line =~ %r{GET /ongoing/When/\d\d\dx/(\d\d\d\d/\d\d/\d\d/[^ .]+) }
# counts[$1] += 1
# end
#end
#keys_by_count = counts.keys.sort { |a, b| counts[b] <=> counts[a] }
#keys_by_count[0 .. 9].each do |key|
# puts "#{counts[key]}: #{key}"
#end
Jump to Line
Something went wrong with that request. Please try again.