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

22 Commits

Author SHA1 Message Date
Wolfgang Stöggl
fdf0295753 Fix minor typos (#286)
- Typos were found by codespell v1.15.0
2019-08-21 07:46:11 -07:00
Arseny Kapoulkine
c55ea3bc1e XPath: Make remove_duplicates generate stable order
Given an unsorted sequence, remove_duplicates would sort it using the
pointer value of attributes/nodes and then remove consecutive
duplicates.

This was problematic because it meant that the result of XPath queries
was dependent on the memory allocation pattern. While it's technically
incorrect to rely on the order, this results in easy to miss bugs.

This is particularly common when XPath queries use union operators -
although we also will call remove_duplicates in other cases.

This change reworks the code to use a hash set instead, using the same
hash function we use for compact storage. To make sure it performs well,
we allocate enough buckets for count * 1.5 (assuming all elements are
unique); since each bucket is a single pointer unlike xpath_node which
is two pointers, we need somewhere between size * 0.75 and size * 1.5
temporary storage.

The resulting filtering is stable - we remove elements that we have seen
before but we don't change the order - and is actually significantly
faster than sorting was.

With a large union operation, before this change it took ~56 ms per 100
query invocations to remove duplicates, and after this change it takes
~20ms.

Fixes #254.
2019-02-26 23:57:58 -08:00
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
02cee98492 tests: Add more tests for branch coverage
gcov -b surfaced many lines with partial coverage, where branch is only
ever taken or not taken, or one of the expressions in a complex
conditional is always either true or false. This change adds a series of
tests (mostly focusing on XPath) to reduce the number of partially
covered lines.
2017-01-30 21:58:48 -08:00
Stephan Beyer
f7aa65db8a Fix whitespace issues
Git warns when it finds "whitespace errors". This commit gets
rid of these whitespace errors for code and adoc files.
2016-01-24 14:05:44 +01: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
97a515f873 tests: Add more XPath mod tests 2014-11-03 07:50:00 +01:00
arseny.kapoulkine@gmail.com
48f9343c05 XPath: Add unit test for unary minus and union precedences
git-svn-id: http://pugixml.googlecode.com/svn/trunk@929 99668b35-9821-0410-8761-19e4c4f06640
2012-11-17 22:50:05 +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
d8b256203c tests: Added more XPath tests based on recommendation errata
git-svn-id: http://pugixml.googlecode.com/svn/trunk@483 99668b35-9821-0410-8761-19e4c4f06640
2010-05-31 12:00:38 +00:00
arseny.kapoulkine
d567700d19 tests: Added more tests (including a couple of failing ones)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@474 99668b35-9821-0410-8761-19e4c4f06640
2010-05-30 18:21:49 +00:00
arseny.kapoulkine
162962a736 tests: Fixed tests for wchar_t mode, disabled some tests on compilers with broken NaN behavior
git-svn-id: http://pugixml.googlecode.com/svn/trunk@463 99668b35-9821-0410-8761-19e4c4f06640
2010-05-29 13:36:53 +00:00
arseny.kapoulkine
ff19e9475a tests: Added more XPath tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@458 99668b35-9821-0410-8761-19e4c4f06640
2010-05-29 09:01:10 +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
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
a70f6b1a70 tests: CodeWarrior and BCC supported
git-svn-id: http://pugixml.googlecode.com/svn/trunk@195 99668b35-9821-0410-8761-19e4c4f06640
2009-10-29 21:47:37 +00:00
arseny.kapoulkine
fc602fd375 tests: Supported all pugixml compilation modes
git-svn-id: http://pugixml.googlecode.com/svn/trunk@191 99668b35-9821-0410-8761-19e4c4f06640
2009-10-29 07:17:30 +00:00
arseny.kapoulkine
0640f87859 tests: More fixes and toolsets support
git-svn-id: http://pugixml.googlecode.com/svn/trunk@190 99668b35-9821-0410-8761-19e4c4f06640
2009-10-28 22:22:19 +00:00
arseny.kapoulkine
e2ac08d5b4 tests: Fixed NaN tests for MSVC6
git-svn-id: http://pugixml.googlecode.com/svn/trunk@189 99668b35-9821-0410-8761-19e4c4f06640
2009-10-28 21:15:05 +00:00
arseny.kapoulkine
45dc0226d1 tests: Added one more normalize-space test, added tests for all logical & comparison operators
git-svn-id: http://pugixml.googlecode.com/svn/trunk@183 99668b35-9821-0410-8761-19e4c4f06640
2009-10-28 18:39:43 +00:00
arseny.kapoulkine
83183769c1 tests: Added function arguments tests, added arithmetic operators tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@181 99668b35-9821-0410-8761-19e4c4f06640
2009-10-28 07:40:15 +00:00