Re-organized/cleaned up the benchmarks directory.
This commit is contained in:
parent
b8cc6b5031
commit
5259c31b36
|
@ -1,7 +0,0 @@
|
|||
require_relative '../../benchmark_helper'
|
||||
|
||||
Benchmark.bmbm(10) do |bench|
|
||||
bench.report '10MB of XML using IO' do
|
||||
Oga::XML::Lexer.new(big_xml_file).advance { |tok| }
|
||||
end
|
||||
end
|
|
@ -1,9 +0,0 @@
|
|||
require_relative '../../benchmark_helper'
|
||||
|
||||
xml = read_big_xml
|
||||
|
||||
Benchmark.bmbm(10) do |bench|
|
||||
bench.report '10MB of XML' do
|
||||
Oga::XML::Lexer.new(xml).advance { |tok| }
|
||||
end
|
||||
end
|
|
@ -1,9 +0,0 @@
|
|||
require_relative '../../benchmark_helper'
|
||||
|
||||
html = read_html
|
||||
|
||||
Benchmark.bmbm(20) do |bench|
|
||||
bench.report 'lex HTML' do
|
||||
Oga::XML::Lexer.new(html, :html => true).lex
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
require_relative '../../benchmark_helper'
|
||||
|
||||
xml = read_big_xml
|
||||
|
||||
Benchmark.ips do |bench|
|
||||
bench.report '10MB as a String' do
|
||||
Oga::XML::Lexer.new(xml).advance { }
|
||||
end
|
||||
|
||||
bench.report '10MB as an IO' do
|
||||
Oga::XML::Lexer.new(big_xml_file).advance { }
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
require_relative '../../benchmark_helper'
|
||||
|
||||
xml = read_big_xml
|
||||
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)}"
|
|
@ -1,10 +0,0 @@
|
|||
require_relative '../../benchmark_helper'
|
||||
|
||||
xml = read_big_xml
|
||||
parser = Oga::XML::Parser.new(xml)
|
||||
|
||||
Benchmark.bmbm(10) do |bench|
|
||||
bench.report '10MB of XML' do
|
||||
parser.parse
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
require_relative '../../benchmark_helper'
|
||||
|
||||
xml = read_big_xml
|
||||
|
||||
Benchmark.ips do |bench|
|
||||
bench.report '10MB as a String' do
|
||||
Oga::XML::Parser.new(xml).parse
|
||||
end
|
||||
|
||||
bench.report '10MB as an IO' do
|
||||
Oga::XML::Parser.new(big_xml_file).parse
|
||||
end
|
||||
end
|
|
@ -1,10 +0,0 @@
|
|||
require_relative '../../benchmark_helper'
|
||||
|
||||
xml = read_big_xml
|
||||
parser = Oga::XML::PullParser.new(xml)
|
||||
|
||||
Benchmark.bmbm(10) do |bench|
|
||||
bench.report '10MB of XML' do
|
||||
parser.parse { |node| }
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
require_relative '../../benchmark_helper'
|
||||
|
||||
xml = read_big_xml
|
||||
|
||||
Benchmark.ips do |bench|
|
||||
bench.report '10MB as a String' do
|
||||
Oga::XML::PullParser.new(xml).parse { }
|
||||
end
|
||||
|
||||
bench.report '10MB as an IO' do
|
||||
Oga::XML::PullParser.new(big_xml_file).parse { }
|
||||
end
|
||||
end
|
|
@ -3,7 +3,7 @@ require_relative '../../benchmark_helper'
|
|||
xpath = '/wikimedia/projects/project[@name="Wikipedia"]/editions/edition/text()'
|
||||
|
||||
Benchmark.ips do |bench|
|
||||
bench.report 'simple XPath' do
|
||||
Oga::XPath::Lexer.new(xpath).lex
|
||||
bench.report 'Wikipedia example' do
|
||||
Oga::XPath::Lexer.new(xpath).advance { }
|
||||
end
|
||||
end
|
|
@ -1,9 +0,0 @@
|
|||
require_relative '../../benchmark_helper'
|
||||
|
||||
xpath = '/wikimedia/projects/project[@name="Wikipedia"]/editions/edition/text()'
|
||||
|
||||
Benchmark.bmbm(10) do |bench|
|
||||
bench.report 'simple XPath' do
|
||||
Oga::XPath::Lexer.new(xpath).lex
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue