[phc-general] Status update
Edsko de Vries
edsko at phpcompiler.org
Thu Nov 30 14:40:21 CET 2006
Hi,
This is just a quick message to let you guys know what is going on with
phc. Unfortunately, the last few months have seen very little phc
development as we have all been very busy with other stuff, but the good
news is, we are back working on phc! :-) For a long time we've been
trying to design a good IR (internal representation) for PHP (I sent an
email around a while ago with some design proposals), but we have
decided that it at this point it is to early to do that.
Instead, the next release of phc will compile PHP code directly to C.
The plan is to support all of PHP, and be fully compatible with PHP.
Both of those goals should be relatively easy to achieve, as the
generated code will essentially consist of lots of calls into the Zend
API (so the compiled code is no longer interpreted, but still uses the
same Zend API that the interpreted code would). With that release, you
will be able to compile your PHP scripts into standalone applications or
indeed into PHP extensions!
We have started writing the code generator, and I'm happy to report that
even with what little we have, it is already showing a speed
improvement! For example, take the following PHP script:
<?php
function factorial($n)
{
if($n == 0)
return 1;
else
return $n * factorial($n - 1);
}
var_dump(factorial(15));
?>
On my machine, running this a hundred times with the PHP interpreter
gives me a running time of just under 16 seconds. When compiled to a
standalone application using phc, it takes only 6 seconds! Of course,
this is a very small application, and perhaps not representative for
"real" PHP code, but still :)
The plan is to finish this code generator (which incidentally will work
on all platforms since it generates C code), and release that as phc
0.2. Then we plan to abstract the C code into an IR, and then have a
C code generator for the IR (so we will keep supporting the C
generator, although in a different form). Once we have an IR, we can
start analysing the PHP code and begin optimizing it - that's when the
fun really starts :-)
Edsko
More information about the phc-general
mailing list