summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-11-07 19:08:49 +0100
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-11-07 19:08:49 +0100
commitd854b0219dcb1cecc42e87b1c397cb683967b74d (patch)
tree7f0735de5e68668def06fcd1883799928fc35b13
parentdb78f34054275890000e0f114100730022e5ad16 (diff)
XPath: Only call apply_predicates if necessary
In some cases constant overhead on step evaluation is important - i.e. for queries that evaluate a simple step in a predicate expression. Eliminating a redundant function call thus can prove worthwhile. This change makes some queries (e.g. //*[not(*)]) 4% faster.
-rw-r--r--src/pugixml.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index a3aaf76..1a93d47 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -9025,13 +9025,13 @@ PUGI__NS_BEGIN
if (axis != axis_self && size != 0) ns.set_type(xpath_node_set::type_unsorted);
step_fill(ns, *it, stack.result, once, v);
- apply_predicates(ns, size, stack, eval);
+ if (_right) apply_predicates(ns, size, stack, eval);
}
}
else
{
step_fill(ns, c.n, stack.result, once, v);
- apply_predicates(ns, 0, stack, eval);
+ if (_right) apply_predicates(ns, 0, stack, eval);
}
// child, attribute and self axes always generate unique set of nodes