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.
11 lines
198 B
Ruby
11 lines
198 B
Ruby
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
|