Thanks to both responders, although neither change has made a difference to the speed (it was useful to learn the shortened way of opening the xml document though!)
Some PHP profiling suggests it's specifically the...
$xml = $query->execute();
...line with is bottleneck.
An export of the Links.xml, by the way, shows that it's a 4.4meg file, so it's not small, but it's all localhost so it's not a network issue as far as I'm aware.
Thanks, Jon.
-----Original Message----- From: Christian GrĂ¼n [mailto:christian.gruen@gmail.com] Sent: 05 December 2012 11:19 To: Mayer, Jonathan Cc: basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] Query slow via PHP
When running this command in basex on linux it completes in around 2.5 seconds (acceptable speed given the size of the XML file) but when I run it via PHP using the client from the website, it takes around 15 seconds:
There should be no considerable difference reg. the APIs you are using, so.. could you do some more profiling to find out which step of your PHP query takes so long?
$input = "for $doc in collection('project') where matches(document-uri($doc), '^Links.xml') return $doc";
Btw, the following may be faster in boh cases:
db:open('project', 'Links.xml')
Best, Christian