Same XQuery faster 2nd+ time

Tuesday, 18 August 2015 · 3 messages · last reply 21 Aug 2015
PS
Philipp Steiner18 Aug 2015 17:29 #
Hi, i'm a student learning XPath/XQuery/BaseX and currently experiment with XQueries on large xml files in BaseX, hope i didn't miss something obvious :) Test: 1st FLOWR query on collection: ~700ms 2nd+ identical query same collection: just ~200ms ! ? My XML-files are OPTIMIZE'd on import, but the created indexes would influence the 1st query already. This is a great speed bump, but hard on tests that assume a first query on a recently imported new collection. So i wondered how this behavior could be explained & maybe turned off for testing purposes? Cheers, Philipp
CG
Christian Grün18 Aug 2015 17:43 #
Hi Philipp,
Quoted text · Philipp Steiner · 2 lines
> 1st FLOWR query on collection: ~700ms > 2nd+ identical query same collection: just ~200ms !
If I get it right, you ran the same query, and the second run was faster than the first run? This will mostly be the case, no matter which database you are testing. Once a query has been run, the requested data will be available in disk or main memory caches. Moreover, Java will also get faster and faster due to Just-In-Time compilation. If you want to do some serious benchmarking, you should use the client/server architecture of BaseX and start your real test after "warming up" your server instance (i.e., running all kinds of queries). Best, Christian
Quoted text · Philipp Steiner · 11 lines
> My XML-files are OPTIMIZE'd on import, but the created indexes would > influence the 1st query already. This is a great speed bump, but hard on > tests that assume a first query on a recently imported new collection. So i > wondered how this behavior could be explained & maybe turned off for testing > purposes? > > Cheers, > Philipp > > >
PS
Philipp Steiner21 Aug 2015 09:00 #
Hi Christian, thank you, good to know, that's exactly the answer i was looking for. I will change my benchmarks accordingly... All the best, Philipp
Quoted text · Christian Grün · 35 lines
On 18.08.2015 17:43, Christian Grün wrote: > Hi Philipp, > >> 1st FLOWR query on collection: ~700ms >> 2nd+ identical query same collection: just ~200ms ! > > If I get it right, you ran the same query, and the second run was > faster than the first run? > > This will mostly be the case, no matter which database you are > testing. Once a query has been run, the requested data will be > available in disk or main memory caches. Moreover, Java will also get > faster and faster due to Just-In-Time compilation. > > If you want to do some serious benchmarking, you should use the > client/server architecture of BaseX and start your real test after > "warming up" your server instance (i.e., running all kinds of > queries). > > Best, > Christian > > > >> My XML-files are OPTIMIZE'd on import, but the created indexes would >> influence the 1st query already. This is a great speed bump, but hard on >> tests that assume a first query on a recently imported new collection. So i >> wondered how this behavior could be explained & maybe turned off for testing >> purposes? >> >> Cheers, >> Philipp >> >> >>

⚡Generated with XQuery