Benchmark Oga XPath evaluation without the parser.

This gives better insight in the performance of the evaluator itself.
This commit is contained in:
Yorick Peterse committed 2014-09-02 20:55:42 +02:00
1 parent 84d6ba96c2
commit d92133ef43
2 files changed
+22 -2

No files matched your search

+13 -2
View File
@@ -79,10 +79,21 @@ module Oga
# evaluator.evaluate('//a')
#
# @param [String] string An XPath expression as a String.
# @return [Oga::XML::Node]
# @return [Mixed]
#
def evaluate(string)
ast = Parser.new(string).parse
ast = Parser.new(string).parse
return evaluate_ast(ast)
end
##
# Evaluates a pre-parsed XPath expression.
#
# @param [Oga::XPath::Node] ast_node
# @return [Mixed]
#
def evaluate_ast(ast)
context = XML::NodeSet.new([@document])
return process(ast, context)