[xml] XPath performance



Hi,
When accessing XML tree that has structure outlined bellow and which
contains hundreds of thousands of "doc" nodes and using something like

xmlXPathEvalExpression(/job/doc[100000]/page/meta/meta_type/meta1, xpathCtx);

the performance is not acceptable. I wander if there is any way to
improve performance (maybe use something like xmlXPathCompile?). I
tried also xmlXPathOrderDocElems but it does not seems to help.

I do not have experience with XPath so maybe it is just not possible
to get reasonable performance for such task but maybe the use of
xmlXPathEvalExpression is very naive.

Thank you,
Karel

P.S.

if the job node could contain only doc nodes and we could do something like:

xmlXPathEvalExpression(/job/*[100000]/page/meta/meta_type/meta1, xpathCtx);

the performance is much better but still not acceptable for our application.


<job>
<doc id="1">
  <page>
    <meta>
      <meta_type>
        <meta0>a</meta0>
      </meta_type>
    </meta>
  </page>
</doc>
...
<doc id="2">
  <page>
    <meta>
      <meta_type>
        <meta0>b</meta0>
      </meta_type>
    </meta>
  </page>
</doc>
</job>



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