Move HTML lexer benchmarks to a separate directory
This commit is contained in:
1 parent
3c6263d8de
commit
ce10ac779d
2 files changed
No files matched your search
@@ -0,0 +1,9 @@
|
||||
require_relative '../../benchmark_helper'
|
||||
|
||||
html = read_html
|
||||
|
||||
Benchmark.ips do |bench|
|
||||
bench.report 'lex HTML' do
|
||||
Oga::XML::Lexer.new(html, :html => true).advance { }
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,23 @@
|
||||
require_relative '../../benchmark_helper'
|
||||
|
||||
content = ''
|
||||
max_size = 5 * 1024 * 1024
|
||||
|
||||
while content.bytesize <= max_size
|
||||
content << "<br>"
|
||||
end
|
||||
|
||||
html = "<body>#{content}</body>"
|
||||
html_caps = "<body>#{content.upcase}</body>"
|
||||
|
||||
Benchmark.ips do |bench|
|
||||
bench.report 'void elements' do
|
||||
Oga::XML::Lexer.new(html, :html => true).advance { }
|
||||
end
|
||||
|
||||
bench.report 'void elements caps' do
|
||||
Oga::XML::Lexer.new(html_caps, :html => true).advance { }
|
||||
end
|
||||
|
||||
bench.compare!
|
||||
end
|
||||
Reference in new issue
Block a user