This pages shows the relative performance of recursive and iterative methods of calculating the Fibonnacci series in XQuery. The code is explained in the XQuery Wikibook.
| n | fib | recursive | iterative |
|---|---|---|---|
| -1 | 0.2 | 0 | |
| 0 | 0 | 0 | 0 |
| 1 | 1 | 0 | 0 |
| 2 | 1 | 0 | 0.2 |
| 3 | 2 | 0 | 0 |
| 4 | 3 | 0.2 | 0.2 |
| 5 | 5 | 0.2 | 0.2 |
| 6 | 8 | 0.4 | 0.2 |
| 7 | 13 | 0.8 | 0.2 |
| 8 | 21 | 1.4 | 0.2 |
| 9 | 34 | 2 | 0.4 |
| 10 | 55 | 3.2 | 0.2 |
| 11 | 89 | 6 | 0.4 |
| 12 | 144 | 8.6 | 0.2 |
| 13 | 233 | 14 | 0.2 |
| 14 | 377 | 22.8 | 0.2 |
| 15 | 610 | 37.6 | 0.4 |