0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-27 13:33:17 +08:00

34 Commits

Author SHA1 Message Date
Arseny Kapoulkine
5867aff943 tests: Make using namespace more explicit
Hiding using namespace in common.hpp is somewhat surprising so remove
common.hpp and move using namespace into all .cpp files that need it.
2017-06-22 20:41:08 -07:00
Arseny Kapoulkine
0027b6ac79 tests: Improve XPath coverage
Add memory allocation failure test for concact with a very large list
and make sure we have every single axis covered with and without a
predicate, with and without a previous step.
2017-06-16 22:45:42 -07:00
Arseny Kapoulkine
a1bc15c8d5 tests: Add more coverage tests
Expand out of memory coverage during XPath parsing and evaluation and
add some other small tests.
2017-01-30 23:52:32 -08:00
Arseny Kapoulkine
417048d8cb tests: Fix tests on various compilers
Some compilers don't handle NaNs properly.
Some compilers don't implement fmod in a IEEE-compatible way.
Some compilers have exception handling codegen bugs (DMC...).
2014-11-19 16:34:57 -08:00
Arseny Kapoulkine
f68a320a02 tests: Improve test coverage 2014-11-01 11:45:13 +01:00
Arseny Kapoulkine
c64d4820b1 XPath: Optimize [position()=expr] and [last()]
To get more benefits from constant predicate/filter optimization we rewrite
[position()=expr] predicates into [expr] for numeric expressions. Right now
the rewrite is only for entire expressions - it may be beneficial to split
complex expressions like [position()=constant and expr] into [constant][expr]
but that is more complicated.

last() does not depend on the node set contents so is "constant" as far as
our optimization is concerned so we can evaluate it once.
2014-10-27 18:50:09 -07:00
Arseny Kapoulkine
d5e29292c6 XPath: Optimize constant filters/predicates
If a filter/predicate expression is a constant, we don't need to evaluate it
for every nodeset element - we can evaluate it once and pick the right element
or keep/discard the entire collection.

If the expression is 1, we can early out on first node when evaluating the
node set - queries like following::item[1] are now significantly faster.

Additionally this change refactors filters/predicates to have additional
metadata describing the expression type in _test field that is filled during
optimization.

Note that predicate_constant selection right now is very simple (but captures
most common use cases except for maybe [last()]).
2014-10-26 09:37:18 -07:00
Arseny Kapoulkine
bbd75fda46 tests: Improve test coverage
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1074 99668b35-9821-0410-8761-19e4c4f06640
2014-10-23 05:46:44 +00:00
Arseny Kapoulkine
3c92704c19 tests: Fix PUGIXML_WCHAR_MODE compilation
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1071 99668b35-9821-0410-8761-19e4c4f06640
2014-10-21 03:38:30 +00:00
Arseny Kapoulkine
7774cdd96e XPath: Make sure step_push is called with valid nodes
Some steps relied on step_push rejecting null inputs; this is no longer
the case. Additionally stepping now more rigorously filters null inputs.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@1069 99668b35-9821-0410-8761-19e4c4f06640
2014-10-21 03:33:37 +00:00
Arseny Kapoulkine
1b8b87904b XPath: Introduce _first/_any set evaluation modes
Sometimes when evaluating the node set we don't need the entire set and
only need the first element in docorder or any element. In the absence of
iterator support we can still use this information to short-circuit
traversals.

This does not have any effect on straightforward node collection queries,
but frequently improves performance of complex queries with predicates
etc. XMark benchmark gets 15x faster with some queries enjoying 100x
speedup on 10 Mb dataset due to a significant complexity improvement.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@1067 99668b35-9821-0410-8761-19e4c4f06640
2014-10-20 01:00:48 +00:00
Arseny Kapoulkine
72ec01c5f6 XPath: Extend the descendant-or-self optimization
Use descendant-or-self::node() transformation for self, descendant and
descendant-or-self axis. Self axis should be semi-frequent; descendant
axes should not really be used with // but if they ever are the complexity
of the step becomes quadratic so it's better to optimize this if possible.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@1063 99668b35-9821-0410-8761-19e4c4f06640
2014-10-18 15:28:02 +00:00
Arseny Kapoulkine
5da51dff27 XPath: Optimize attribute axis lookup
When looking for an attribute by name, finding the first attribute means
we can stop looking since attribute names are unique. This makes some
queries faster by 40%.

Another very common pattern in XPath queries is finding an attribute with
a specified value using a predicate (@name = 'value'). While we perform an
optimal amount of traversal in that case, there is a substantial overhead
with evaluating the nodes, saving and restoring the stack state, pushing
the attribute node into a set, etc. Detecting this pattern allows us to
use optimized code, resulting in up to 2x speedup for some queries.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@1061 99668b35-9821-0410-8761-19e4c4f06640
2014-10-16 03:46:42 +00:00
Arseny Kapoulkine
883031fb45 XPath: Fix optimization bug with //name[last()]
The actual condition for the optimization is invariance from context list
-- this includes both position() and last().

Instead of splitting the posinv concept just include last() into
non-posinv expressions - this requires sorting for boolean predicates that
depend on last() and do not depend on position(). These cases should be
very rare.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@1060 99668b35-9821-0410-8761-19e4c4f06640
2014-10-15 06:05:49 +00:00
Arseny Kapoulkine
9e6dcc292d tests: Add XPath sorting test
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1054 99668b35-9821-0410-8761-19e4c4f06640
2014-10-05 08:39:44 +00:00
Arseny Kapoulkine
b17501c3fb tests: Add XPath sorting tests and a simple test for numeric predicates
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1051 99668b35-9821-0410-8761-19e4c4f06640
2014-10-05 04:20:52 +00:00
Arseny Kapoulkine
5b875e8487 tests: Add one more XPath optimization test
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1022 99668b35-9821-0410-8761-19e4c4f06640
2014-09-23 04:40:05 +00:00
Arseny Kapoulkine
89fc7c241c tests: More XPath tests
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1020 99668b35-9821-0410-8761-19e4c4f06640
2014-09-23 04:39:51 +00:00
arseny.kapoulkine
6d44879c5a tests: Minor fixes
git-svn-id: http://pugixml.googlecode.com/svn/trunk@691 99668b35-9821-0410-8761-19e4c4f06640
2010-08-29 15:48:05 +00:00
arseny.kapoulkine
e08c065820 tests: Added XPath tests for attribute context
git-svn-id: http://pugixml.googlecode.com/svn/trunk@664 99668b35-9821-0410-8761-19e4c4f06640
2010-08-29 15:27:51 +00:00
arseny.kapoulkine
7d24b9b565 Set svn:eol-style to native for all text files
git-svn-id: http://pugixml.googlecode.com/svn/trunk@607 99668b35-9821-0410-8761-19e4c4f06640
2010-07-19 09:57:32 +00:00
arseny.kapoulkine
724a377544 tests: Added more Xalan tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@473 99668b35-9821-0410-8761-19e4c4f06640
2010-05-30 12:42:03 +00:00
arseny.kapoulkine
e91b5e3059 tests: Added tests for principal node types with attributes for all axes that can return attributes
git-svn-id: http://pugixml.googlecode.com/svn/trunk@471 99668b35-9821-0410-8761-19e4c4f06640
2010-05-30 07:52:18 +00:00
arseny.kapoulkine
43fc0ca13b tests: Added more Xalan tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@467 99668b35-9821-0410-8761-19e4c4f06640
2010-05-29 22:51:38 +00:00
arseny.kapoulkine
d1b41ba178 tests: Added some axis Xalan tests, extended all axis tests to include attribute context nodes
git-svn-id: http://pugixml.googlecode.com/svn/trunk@465 99668b35-9821-0410-8761-19e4c4f06640
2010-05-29 20:11:12 +00:00
arseny.kapoulkine
5ff56a6d68 Removed document order optimization (it helps on a tiny percentage of queries), XPath tests now compute their own order
git-svn-id: http://pugixml.googlecode.com/svn/trunk@400 99668b35-9821-0410-8761-19e4c4f06640
2010-05-09 20:37:49 +00:00
arseny.kapoulkine
f542c5ebb8 Integrated changes from unicode branch to trunk
git-svn-id: http://pugixml.googlecode.com/svn/trunk@383 99668b35-9821-0410-8761-19e4c4f06640
2010-05-06 20:28:36 +00:00
arseny.kapoulkine
f02208b12f tests: Final coverage improvements
git-svn-id: http://pugixml.googlecode.com/svn/trunk@229 99668b35-9821-0410-8761-19e4c4f06640
2009-11-08 16:15:05 +00:00
arseny.kapoulkine
0cac815b63 tests: More coverage tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@225 99668b35-9821-0410-8761-19e4c4f06640
2009-11-08 15:17:46 +00:00
arseny.kapoulkine
48bbb9f4dd tests: Extracted generic tests in a separate header, better filter tests, some API tests added
git-svn-id: http://pugixml.googlecode.com/svn/trunk@221 99668b35-9821-0410-8761-19e4c4f06640
2009-11-08 13:52:55 +00:00
arseny.kapoulkine
e3293a8baa tests: Mostly complete coverage of XPath W3C
git-svn-id: http://pugixml.googlecode.com/svn/trunk@217 99668b35-9821-0410-8761-19e4c4f06640
2009-11-08 12:25:56 +00:00
arseny.kapoulkine
f22d0647a2 tests: Added node test tests, added abbreviated step/axis tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@212 99668b35-9821-0410-8761-19e4c4f06640
2009-11-08 10:14:29 +00:00
arseny.kapoulkine
6948d1f171 tests: Completed function library tests, added namespace axis and variable reference tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@204 99668b35-9821-0410-8761-19e4c4f06640
2009-11-04 19:23:20 +00:00
arseny.kapoulkine
af04c0f754 tests: Added tests for all axes except namespace
git-svn-id: http://pugixml.googlecode.com/svn/trunk@201 99668b35-9821-0410-8761-19e4c4f06640
2009-11-03 19:55:15 +00:00