wget timings of match="id(xxx)" versus match="//*[@id=xxx]":
------------------------------------------------------------

time wget http://saturn.gan.no:8888/mup/xpath.xsp?xpath=KAP1 - 0m14.686s
(first hit)
time wget http://saturn.gan.no:8888/mup/xpath.xsp?xpath=KAP1 - 0m0.030s
(second hit)

time wget http://saturn.gan.no:8888/mup/id.xsp?id=KAP1 - 0m5.882s (first
hit)
time wget http://saturn.gan.no:8888/mup/id.xsp?id=KAP1 - 0m0.012s (second
hit)


these stats show that Joerg's tips about using a id() lookup instead of a
xpath lookup upon id attributes was correct, id() performed 2,5 times better
on first hit, and also on cached result. I will now start to edit all my XML
files and use id() lookup instead! thanks!!!

mvh Karl Xie



> Can you give us a feed back? ;)
>
> Thanks,
>
> --Arnaud



> If you have a DTD for your XML and your @id is really unique in the whole
> XML, you can use the id()-function of XPATH. Instead of "//*[@id='1222']"
> use "id('1222')". This takes much less time than your statement (around
> factor 10; of course dependent on the size of the XML, my XML was
> 150 KB ->
> maybe better factor for you).
>
> Joerg


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to