xsl-list
[Top] [All Lists]

Re: Re: xsl:for-each evaluator?

2003-06-11 14:12:41

"Jeff Kenton" <jkenton(_at_)datapower(_dot_)com> wrote in message
news:3EE79057(_dot_)1020506(_at_)datapower(_dot_)com(_dot_)(_dot_)(_dot_)
Dimitre Novatchev wrote:
In case you were asking about the time it would take to evaluate the
xsl:for-each, the answer is that this in general is impossible to
predict -- 
there is a theorem in the theory of Algorithms (about universal
functions, I
think), which states that in general it is impossible if a computation
is
going to terminate.


Well, theory is a wonderful thing, but in this case the original poster
knew it was going to terminate.  All he wanted was a way to count the passes
through the loop and a way to measure how long it took.

Some things are easier in the real world than in theory.


One *cannot know* if a program will terminate -- unless this property has a
strict proof.

Do you know with 100% certainty that a program has no bugs? Even if it is
proven that a program is correct, the termination condition may still depend
on the data -- e.g. calculating an integral in an interval, where there is a
point on which the function is not well defined -- e.g. Integral(logX)(0,1)
is non-terminating, but Integral(logX)(eps, 1) where eps is sufficiently
close to zero is terminating and may "take forever" to terminate.

Or the very simple case, when the code is an endless recursion -- then the
evaluation of xsl:for-each will not terminate but will itself be terminated.

I repeat what I was saying -- it is not known what piece of code would be
put in the body of the xsl:for-each instruction. In case the original
question asks how to measure the time it takes to evaluate this xsl:for-each
instruction, the answer is that generally this is impossible, because there
might be some very long computation inside the body of xsl:for-each, which
could take indefinitely long.


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list