oga/benchmark/css/parser/parser_bench.rb

16 lines
308 B
Ruby
Raw Normal View History

2015-02-13 08:36:24 +00:00
require_relative '../../benchmark_helper'
css = 'foo bar bar.some_class element#with_id[title="Foo"]'
Benchmark.ips do |bench|
bench.report 'without cache' do
2015-02-13 08:36:24 +00:00
Oga::CSS::Parser.new(css).parse
end
bench.report 'with cache' do
Oga::CSS::Parser.parse_with_cache(css)
end
bench.compare!
2015-02-13 08:36:24 +00:00
end