Re: [xslt] Performance issue when matching text()|*
- From: Kasimier Buchcik <kbuchcik 4commerce de>
- To: veillard redhat com, The Gnome XSLT library mailing-list <xslt gnome org>
- Cc:
- Subject: Re: [xslt] Performance issue when matching text()|*
- Date: Fri, 28 Jan 2005 18:00:12 +0100
Daniel Veillard wrote:
On Fri, Jan 28, 2005 at 08:12:00AM -0800, Jerome Pesenti wrote:
We encountered a strange performance problem related
to the cost of building large nodesets. In
You are not building large node sets. You are building 1 huge text
node a few bytes at a time. XPath model requires coalescing of adjacent
text nodes and apparently the fix to make it linear doesn't seems to work
in all cases see also http://bugzilla.gnome.org/show_bug.cgi?id=165107
Just out of curiosity; the spec says:
"text() selects all text node children of the context node"
"Function: number count(node-set)
The count function returns the number of nodes in the argument
node-set."
Why does this build 1 huge text node?
particular, it seems that the cost of building a
nodeset is not linear in the size. To demonstrate
it's not a node set it's
make text node, size 10,
while ...
add a text node sibling size 10
coalesce both text nodes
coalescing without trick means: realloc() existing string to
the sum of both string size, copy the new string , free the new
text node.
And that is of course quadratic if you don't prealocate memory and
keep len(old_string) around.
There is a fix in libxslt to avoid this. Unfortunately your XSLt code
seems to break that optimization.
Daniel
Kasimier
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]