Jochen,
The test I mention is not something we have come up with. XQTS is the
official testsuite to test XQuery compliance, and the query I mention is
one out of that suite.
The fact that this query takes a long time means that we need to fix the
engine to make this case more efficient.
If you are interested I could describe in more detail the exact issue
and some possible fixes.
Vinayak
Jochen Wiedmann wrote:
Consider to enable the test only if some system property is set. A
normal user won't be able to distinguish between "infinite loop" and
"tales a very very long time".
Alternatively, select a representative subset of the 1.1M integers and
restrict the test to those.
Jochen
On Mon, Jan 4, 2010 at 9:50 PM, Vinayak Borkar <[email protected]> wrote:
Its not an infinite loop --
Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-document-3.xq
is taking a long time to run. I am pasting the query below.
The query iterates over about 1.1 M integers 70 at a time and calls
subsequence() for the 70 items in the window. This is a quadratic operation
in the engine -- and takes a long time.
Should we optimize this case?
Thanks,
Vinayak
--- Query begin ---
declare variable $codepoints as xs:integer+ := (9, (: 0x9 :)
10,(: 0xA :)
13,(: 0xD :)
32 to 55295, (: 0x20 - 0xD7FF
:)
57344 to 65532, (: 0xE000 -
0xFFFD :)
65536 to 1114111 (: 0x10000 -
0x10FFFF :));
declare variable $count as xs:integer := count($codepoints);
declare variable $lineWidth as xs:integer := 70;
<allCodepoints>
<!-- Each <r>-element represents a codepoint range. The 's' attribute
is the start codepoint, the 'e' attribute is the end codepoint.
Note that these are only *Hints*, since the character range is not
contiguous.
-->
{
"
",
"
",
(: The outputted file is rather big, so to make it managable, we output
a chunk of $lineWidth characters in each element.
:)
for $i in (1 to $count idiv $lineWidth)
let $startOffset := (($i - 1) * $lineWidth) + 1
return (<r s="{$codepoints[$startOffset]}"
e="{$codepoints[$startOffset] + $lineWidth}">
{
codepoints-to-string(subsequence($codepoints,
$startOffset, $lineWidth))
}
</r>, "
")
}
</allCodepoints>
--- Query end ---
Vinayak Borkar wrote:
Till,
Does XTest on the test suite terminate? Some query is throwing the engine
into an infinite loop. Do you see this?
Thanks,
Vinayak