From 8f562c24ddfcf8be367ee39c3d7b7cf7cd658b04 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Fri, 5 Sep 2014 10:56:49 +0200 Subject: [PATCH] Use NodeSet#concat for descendant-or-self. In a sample XML file this removes around 3400 NodeSet allocations. --- lib/oga/xpath/evaluator.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/oga/xpath/evaluator.rb b/lib/oga/xpath/evaluator.rb index 7508791..4187fae 100644 --- a/lib/oga/xpath/evaluator.rb +++ b/lib/oga/xpath/evaluator.rb @@ -318,8 +318,8 @@ module Oga nodes = XML::NodeSet.new context.each do |context_node| - nodes += on_test(ast_node, context_node.children) - nodes += on_axis_descendant(ast_node, context_node.children) + nodes.concat(on_test(ast_node, context_node.children)) + nodes.concat(on_axis_descendant(ast_node, context_node.children)) end return nodes