oga/benchmark/parser/element.rb

20 lines
445 B
Ruby
Raw Normal View History

2014-05-01 11:08:44 +00:00
require_relative '../benchmark_helper'
2014-04-10 08:05:04 +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
Oga::XML::Parser.new(simple).parse
end
bench.report 'text + attributes' do
Oga::XML::Parser.new(attributes).parse
end
bench.report 'text + children' do
Oga::XML::Parser.new(nested).parse
end
end