XPath evaluation bench to test parsing times

This benchmark is simple enough that the overhead of evaluation is not
far greater than parsing. This makes it suitable for benchmarking the
performance increase of caching XPath ASTs.
This commit is contained in:
Yorick Peterse 2015-03-22 18:31:42 +01:00
parent ad26446a5f
commit 3bb67ddf28
1 changed files with 10 additions and 0 deletions

View File

@ -0,0 +1,10 @@
require_relative '../../benchmark_helper'
document = Oga.parse_xml('<root></root>')
query = 'root'
Benchmark.ips do |bench|
bench.report(query.inspect) do
document.xpath(query)
end
end