Yet Another Efficient PHP Compiler ? Graalphp is an experimental just-in-time (JIT) compiler and runtime for PHP 7.4+ hosted on GraalVM. The project is realized by Andrin Bertschi, from the Advanced Software Technologies (AST) Lab, ETH Zurich. PHP is a popular, weakly typed, general purpose programming language. Originally designed for building dynamic web pages, the language has since gained wide adoption in server-side web development.
GraalPHP is an experimental compiler and runtime for PHP hosted on Truffle and GraalVM. GraalVM is a virtual machine that supports execution of multiple languages, which are implemented as Abstract Syntax Tree (AST) interpreters based on Truffle. GraalVM uses Graal as its JIT compiler to compile frequently executed code fragments to machine code.
A subset of the PHP language have been implemented to run synthetic benchmarks by The Computer Language Benchmarks Game. Then comparing peak performance of the implementation against PHP 7 as well as alternative implementations such as HHVM, JPHP and an early alpha version of PHP 8. Experimental results indicate that GraalPHP runtime reaches competitive results with performance gains of up to 859% compared to PHP 7. These preliminary results suggest that a Truffle-hosted PHP implementation might be significantly faster than existing language implementations.
- Datatypes: int, float, boolean, arrays (sequences) of these types
- Unconditionally defined functions
- Variables in function scope, global scope
- Binary, unary, operations
- while, do while, for, if
More information at https://github.com/abertschi/graalphp