Good evening Daniël,
I have introduced the suggested optimization, considering some more cases like $p = (1 to 10), $p >= 1 and $p <= 3 etc. I would be pleased if you could check out the latest snapshot and do some testing.
Christian
[1] http://files.basex.org/releases/latest/
On Thu, Aug 14, 2014 at 9:11 AM, Daniël Knippers dknippers@gmail.com wrote:
Good morning,
I wondered if there is room for optimization during the compilation of the following query:
let $oneBillion := 1000000000 for $x at $p in (1 to $oneBillion ) where $p = 1 return $x
I would have expected this to be compiled into something like
for $x in (1 to $oneBillion)[1] return $x
Or simply
(1 to $oneBillion)[1]
Judging only from the execution times of the original query versus the optimized ones, it seems the sequence of 1 to one billion is entirely generated, which seems suboptimal in this case.
Kind regards, Daniël Knippers