2014-05-01 11:08:44 +00:00
|
|
|
require_relative '../benchmark_helper'
|
2014-04-17 18:06:24 +00:00
|
|
|
|
2014-05-01 11:08:44 +00:00
|
|
|
xml = read_big_xml
|
2014-04-17 18:06:24 +00:00
|
|
|
lines = xml.lines.count
|
|
|
|
lexer = Oga::XML::Lexer.new(xml)
|
|
|
|
timings = Benchmark.bm(20) do |bench|
|
|
|
|
bench.report("#{lines} lines") do
|
|
|
|
lexer.advance { |_| }
|
|
|
|
lexer.reset
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
time = timings[0].real
|
|
|
|
rate = lines / time
|
|
|
|
|
|
|
|
puts
|
|
|
|
puts "Lines/second: #{rate.round(3)}"
|