Fibonacci

See Wikibook article.
Approach Repetitions Average msec * XQuery length
Iterative function written in tail recursive form. 10 2.1 335
Recursive function using switch expression 10 13.5 225
Recursive function based on the definition of the Fibonacci sequence 10 26.2 232
0 did not run 3829
* relative times are more useful than absolute times. At present the execution time includes compilation of locally-declared functions although the code is cached.