From: Jacob M. <jac...@gm...> - 2010-01-26 14:07:23
|
>> collection("/db/data/mappings") >> [.//Header/Document/Type/Name = "mappings"] >> [.//Header/Document/Type/Version = "v0.7"] >> [.//Body/SourceKind = "TestResults"] >> [.//Body/Test/Type/Name = "masp"] >> [.//Body/Test/Type/Version = "0.0.1"] >> >> If I execute this query directly via oXygen, it takes 8 ms. If I put a >> util:eval around it, it suddenly takes 32 ms. So there is a measurable >> slowdown when using util:eval. I have seen even worse: a util:evaled >> query sometimes took ten times as long as just the query, but this was >> a long time (and many eXist revisions) ago and I cannot reproduce it >> anymore. >> >> Regards, >> Pieter Could this partly have something to do with the fact you have so many node traversal steps in each of those? Is there any way to do some reductions on the query itself, something like (just off the top of my head, can't even be sure this works) collection("/db/data/mappings") [.//Header//(Name = "mappings" and Version = "v0.7")] [.//Body//(SourceKind = "TestResults" and Name = "masp" and Version = "0.0.1")] That might reduce all the steps exist is taking with lookups on nodes. Is oxygen maybe doing something like this to optimize the query before sending it to exist? It seems to me if you put that exact query into exist and ran it, then did the same thing through util:eval you shouldn't see any performance difference at all aside from the overhead of the initial parse of the query prior to eval. I haven't noticed a performance difference using either method on my stuff, but I don't generate large queries, usually just a selector or two. Jacob Myers |