Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:22009 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52532 invoked by uid 1010); 24 Feb 2006 22:05:33 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 52517 invoked from network); 24 Feb 2006 22:05:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Feb 2006 22:05:33 -0000 X-Host-Fingerprint: 129.41.69.185 smtp.dealnews.com Linux 2.5 (sometimes 2.4) (4) Received: from ([129.41.69.185:61248] helo=smtp.dealnews.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 8B/27-30574-D238FF34 for ; Fri, 24 Feb 2006 17:05:33 -0500 Received: (qmail 15886 invoked from network); 24 Feb 2006 17:05:29 -0500 Received: from unknown (HELO ?10.1.6.4?) (10.1.6.4) by 10.1.1.24 with SMTP; 24 Feb 2006 17:05:29 -0500 Message-ID: <43FF8329.2080803@dealnews.com> Date: Fri, 24 Feb 2006 16:05:29 -0600 User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: php internals Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: PHP and Recursion From: brianm@dealnews.com (Brian Moon) 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/