PHP's ability to handle recursion

Recently, I have seen in several places people who say that PHP does not have enough recursion capabilities. I recently wrote a recursive php function to traverse a graph and found it to be very slow compared to java. I don't know if this is due to php's recursion capabilities or because php is slower than java in general.

Some search engines have found this ( http://bugs.php.net/bug.php?id=1901 )

[7 Aug 1999 12:25 pm UTC] zeev at cvs dot php dot net

PHP 4.0 (Zend) uses the stack for intensive data, instead of using heap. This means that its tolerance for recursive functions is significantly lower than that of other languages.

It is relatively easy to tell Zend not to use the stack for this data, and instead use a bunch - to significantly increase the number of recursive functions - at the price of reduced speed. If you are interested in such an environment, let me know, we can add a compile time switch.

What does it mean to say that php uses the stack for intensive data? Does php set a runtime stack? Also, is it generally true that recursion in php is much slower than other languages? And how much?

Thanks!

+5
source share
2 answers

Ok, I'll take a hit on him.

: "" - , C/++. , , ( ). C fibbonaci(int i), i , . . , . . , . ?

.....

, Zend : ( ) , - , - , . ( , , . , - , L1 L2, , CPU , - , , . .)

"" , , , , , . . ? , ? , , : , , ? , ( , , , , ). , , , PHP PHP-... .

, " ?". : ; , , , .

+2

, , , . Java , PHP. , -, PHP.

, PHP , PHP , " " (, ). .

PHP , () - , .

, , , , ...

0

All Articles