Re: PHP tail call optimization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/20/2015 04:54 PM, Marco Perone wrote:
Hello everybody.

From what I understand, PHP does not have tail call optimization.

I would like to ask if there is a reason for this. Is it because this limitation comes from the C language? Is it a feature that was never proposed? Is it a technical reason or a "human" one, or is it just that there is no real reason and nobody ever really needed this?

Until very recently the way the engine was written made it prohibitively difficult and costly to do. Prior to PHP 5.5, having no opcode cache was the norm so compile time needed to be kept to an absolute minimum. That's not the case anymore. Also, PHP 5 has no AST. PHP 7 does have an AST, which means it should be possible to add compile-time optimizations like tail recursion optimization.

That's not planned for PHP 7.0, but I believe people are discussing the potential of it in 7.1 or 7.2. Stay tuned, or if you know C help out. :-)

--Larry Garfield

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux