From 3bb67ddf2859e6208a43bb9a56ae81b16bd4c0ed Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Sun, 22 Mar 2015 18:31:42 +0100 Subject: [PATCH] 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. --- benchmark/xpath/evaluator/simple_bench.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 benchmark/xpath/evaluator/simple_bench.rb diff --git a/benchmark/xpath/evaluator/simple_bench.rb b/benchmark/xpath/evaluator/simple_bench.rb new file mode 100644 index 0000000..e881b45 --- /dev/null +++ b/benchmark/xpath/evaluator/simple_bench.rb @@ -0,0 +1,10 @@ +require_relative '../../benchmark_helper' + +document = Oga.parse_xml('') +query = 'root' + +Benchmark.ips do |bench| + bench.report(query.inspect) do + document.xpath(query) + end +end