2014-05-01 11:08:44 +00:00
|
|
|
require_relative '../benchmark_helper'
|
2014-03-21 16:45:23 +00:00
|
|
|
|
|
|
|
simple = '<p>Hello world</p>'
|
|
|
|
attributes = '<p class="foo">Hello world</p>'
|
|
|
|
nested = '<p>Hello<strong>world</strong></p>'
|
|
|
|
|
|
|
|
Benchmark.ips do |bench|
|
|
|
|
bench.report 'text only' do
|
2014-04-10 07:55:33 +00:00
|
|
|
Oga::XML::Lexer.new(simple).lex
|
2014-03-21 16:45:23 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
bench.report 'text + attributes' do
|
2014-04-10 07:55:33 +00:00
|
|
|
Oga::XML::Lexer.new(attributes).lex
|
2014-03-21 16:45:23 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
bench.report 'text + children' do
|
2014-04-10 07:55:33 +00:00
|
|
|
Oga::XML::Lexer.new(nested).lex
|
2014-03-21 16:45:23 +00:00
|
|
|
end
|
|
|
|
end
|