diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2014-10-01 07:02:52 +0000 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2014-10-01 07:02:52 +0000 |
commit | febe4f0209f86225ebeedfb0874feb3cb96e7c89 (patch) | |
tree | 88e590e12b404bdfcc09f8e822889647c8d005a5 /tests/data/utftest_utf8_clean.xml | |
parent | 89d19df43df8e7962bcf896a528d3214a3c28bbc (diff) |
Implement copyless copy
Now copying nodes or attributes does not copy names/values if the source
strings are in a document buffer. As a result, several nodes can now share
the same string in document buffer - to support this we 'taint' both
source and destination with a special 'shared' bit.
Tainting disables offset_debug() and fast-path document order comparison;
it also prevents strcpy_insitu from reusing the document buffer memory for
the copied node.
The downsides include slower XPath queries in some (rare) cases and
slightly higher memory consumption in some (rare) cases.
XPath queries can execute slower if a lot of old nodes were copied to new
nodes *and* a query only touches old nodes (so it used to benefit a lot
from fast comparison path) *and* a query produces unsorted node sets that
need to be sorted later (both are relatively rare).
Higher memory consumption is possible if a lot of nodes were copied and
all nodes (both new and old) have their contents modified 'in place' --
previously we could modify the old node in place and the new node required
one allocation on copy, and now both nodes have to have their data
allocated during modification. This should also be rare.
On the bright side, in a lot of cases copying of string data can be
avoided - this makes the copy much faster and the document now occupies
less memory. For example, some uses of append_buffer are now actually slower
compared to building up a document by copying a template from the same
document and modifying the copy slightly.
In one of the internal benchmarks copying is now 4x faster (the difference
can be more dramatic with more string contents and less markup).
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1032 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/data/utftest_utf8_clean.xml')
0 files changed, 0 insertions, 0 deletions