Benchmark for measuring CDATA lexing.

This commit is contained in:
Yorick Peterse committed 2014-03-21 16:59:44 +01:00
1 parent 55f116124c
commit 2852afce9b
2 files changed
+23

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
require_relative '../../lib/oga'
require 'benchmark/ips'
string = 'Hello, how are you doing today?'
small = "<![CDATA[#{string}]]>"
medium = "<![CDATA[#{string * 1_000}]]>"
large = "<![CDATA[#{string * 10_000}]]>"
lexer = Oga::Lexer.new
Benchmark.ips do |bench|
bench.report 'CDATA with a small body' do
lexer.lex(small)
end
bench.report 'CDATA with a medium body' do
lexer.lex(medium)
end
bench.report 'CDATA with a large body' do
lexer.lex(large)
end
end
+1
View File
@@ -24,4 +24,5 @@ Gem::Specification.new do |s|
s.add_development_dependency 'yard'
s.add_development_dependency 'simplecov'
s.add_development_dependency 'kramdown'
s.add_development_dependency 'benchmark-ips'
end