From 99615d72f9482203b13d5e3c551bce1fbbe282b3 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Fri, 13 Jun 2014 00:49:24 +0200 Subject: [PATCH] Simple benchmarks for the XPath lexer. --- benchmark/xpath/lexer/simple.rb | 9 +++++++++ benchmark/xpath/lexer/simple_time.rb | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 benchmark/xpath/lexer/simple.rb create mode 100644 benchmark/xpath/lexer/simple_time.rb diff --git a/benchmark/xpath/lexer/simple.rb b/benchmark/xpath/lexer/simple.rb new file mode 100644 index 0000000..f0f6734 --- /dev/null +++ b/benchmark/xpath/lexer/simple.rb @@ -0,0 +1,9 @@ +require_relative '../../benchmark_helper' + +xpath = '/wikimedia/projects/project[@name="Wikipedia"]/editions/edition/text()' + +Benchmark.ips do |bench| + bench.report 'simple XPath' do + Oga::XPath::Lexer.new(xpath).lex + end +end diff --git a/benchmark/xpath/lexer/simple_time.rb b/benchmark/xpath/lexer/simple_time.rb new file mode 100644 index 0000000..84cb694 --- /dev/null +++ b/benchmark/xpath/lexer/simple_time.rb @@ -0,0 +1,9 @@ +require_relative '../../benchmark_helper' + +xpath = '/wikimedia/projects/project[@name="Wikipedia"]/editions/edition/text()' + +Benchmark.bmbm(10) do |bench| + bench.report 'simple XPath' do + Oga::XPath::Lexer.new(xpath).lex + end +end