Re: [xslt] Performance issue when matching text()|*



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

> 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

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]