[xquery-talk] General comparisons of speed of xquery vs. xslt
Per Bothner
per at bothner.com
Wed Apr 28 13:58:18 PDT 2004
Michael Kay wrote:
> In XQuery the natural technique is
> always to pull, which means you end up doing more tree construction and
> copying than is necessary.
Interesting. I think of the natural technique is to "push".
Perhaps we're talking about different things.
To me "pull" means "output demand-driven" or as the funtional
language community calls it "lazy evaluation". By analogy
"push" would be "input data-driven", which I agree is appropriate
for XSLT but not XQuery.
Perhaps we need a new term for the following, which we might call
"execution-driven": The basic control flow of the "interpreter"
follows the "natural execution order" of the query. E.g. you execute
a FLWOR by conceptually evaluting the input sequence, and then
for each item you execute the 'result' body with the given binding.
You execute a function call by executing each parameter, and then
executing the function body with the given bindings. I think of
this as "push" because each time a sub-expression is evaluated
the result is pushed to its consumer. I guess you might think
of this as "pull" because the choice which sub-expression to
execute is done by the parent expression, which pulls a result
from it. However, the "pulling" is a complete result sequence,
not item-by-item as needed. To reduce materializing sequence,
each item is pushed to a consumer.
--
--Per Bothner
per at bothner.com http://per.bothner.com/
More information about the talk
mailing list