Parrot virtual machine, Pint, Plumhead, phc compiler and Drupal

As we all know, PHP is tied to the Zend Engine, which is the heart of PHP. Zend has other products that interface with the Zend Engine, such as the Zend optimizer.

However, over the years there has been efforts to offer community led alternatives to those parts of PHP's underlying layers. For example, APC is a free PHP op-code cache /accelerators that is community driven, and also eAccelerator is another.

Parrot, Pint, Plumhead and phc

Another possible area is whether PHP will use a common scripting engine. One candidate is Parrot, which aims to be a generic virtual machine engine for languages such as Perl.

There was an effort back in 2003 by Alan Knowles to make PHP use Parrot. Although this effort is now abandoned, there is another effort, Plumhead, that promises to do the same thing.

There is also a very interesting project called phc, which is a PHP compiler. It aims at compiling PHP into native machine code, and hence the need for op-code caches and all those tricks vanish.

What does this mean for Drupal?

Well, what does all this mean for Drupal?

If/when Plumhead becomes the underlying mechanism of PHP, replacing Zend, there are some interesting things that could happen. Think about all the common things that would be made to plug into Parrot, for example debuggers and profilers that work for all Parrot based languages. Even parts of Drupal can be rewritten in PIR (Parrot Intermediate Representation) or even Pasm (the Parrot Assembler) for better performance if that is beneficial. Or Drupal can be pre-compiled into PBC (Parrot Bytecode) directly.

Moreover, currently, there is room for further optimization in Drupal's code when there is no op-code cache. As PHP is read, parsed, and tokenized CPU and memory are consumed more and more. This is specially true for shared hosts where op-code caches are not common. When running on a VPS or a dedicated host, op-code caches make these bottlenecks irrelevant.

This can be tuned even further by compiling Drupal into native machine code using phc, and hence it would run as fast as compiled C code! That would be a real performance boost, and the bottleneck would be the database only.


  • Parrot: a virtual machine for scripting languages. See the examples.
  • Pint: a PHP Parrot implementation by Alan Knowles. Now abandoned.
  • Plumhead:a PHP Parrot implementation project underway.
  • phc: A PHP compiler. Does not yet compile PHP, but has some very interesting spinoff projects.
  • Roadsend PHP Compiler, now open source.
  • Quotes from a 2004 interview with Rasmus where he says that Parrot may replace Zend.



get those names right

Well, as Alan's blog post clearly shows, Pint was a project of "Sterling and Thies", that is Sterling Hughes and Thies C. Arntzen. Alan Knowles worked on PHPSharp which was a glue between .NET and PHP.


Thanks for the correction Goba.Regardless, Pint is an abandoned effort. It would have been nice to have a VM for PHP early on.Here is to hoping that Plumhead matures and does not meat the same fate as Pint. More importantly, phc is also very promising.-- Khalid Baheyeldin

Plumhead and PHC

I'm the guy toying with Plumhead, that is PHP on Parrot. It's nice to get some encouragement!
In the last months I haven't done much work on Plumhead, but I plan on picking it up again in July and August.

One of my goals of Plumhead is to compare different parsing strategies for PHP. So one variant of Plumhead is actually based on PHC. I take the XML-output from PHC and transform it with XSLT to an abstract syntax tree that Parrot understands.

Any comments on Caucho's

Any comments on Caucho's Quercus? I run Drupal this way.