Hi guys,

I am working on script that will assemble data to create a page and have come to an interesting conclusion. Its a perfect fit for recursion as part 1 of the doc will require additional parts and so on.

I wrote it at first with two loops. The first loop gathered data and the second arranged the data.

For completeness sake, I rewrote it using recursion where I have a get_data() function that is called within itself if said data needs more data.

The results were quite suprising. I get about a 80% increase in speed (using openload with 20 concurrents to test) using the recursion. Now, at most, I will be recursing 4 or 5 levels deep.

Does PHP optimize recursion in such a way that this is expected or did I get lucky and I may hit a wall when I am not looking?

--
Brian Moon
dealnews.com
--------------
How to go broke saving money.
http://dealnews.com/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to