@@ -25,8 +25,16 @@ It keeps familiar PHP syntax and adds compile-time type information, so the
2525compiler can emit fast, statically-typed C++ for your hot paths — while the
2626rest of your code continues to run on the battle-tested Zend engine.
2727
28+ TypePHP is ** written entirely in PHP** and is ** fully self-hosting** : the ` tpc `
29+ compiler binary is built by compiling the compiler's own PHP source code with
30+ TypePHP. The bootstrap chain is pure PHP — no C or C++ glue in the compiler
31+ itself.
32+
2833## Features
2934
35+ - ** Self-hosting, written in PHP** — the TypePHP compiler is implemented
36+ entirely in PHP and bootstraps itself: ` tpc ` compiles the compiler's own
37+ source into a native binary.
3038- ** True AOT compilation** — PHP is lowered to C++17, then to native machine
3139 code. No interpreter, no opcode cache, no JIT warm-up.
3240- ** Three build modes** — build a standalone ` bin ` executable, a loadable PHP
@@ -87,20 +95,21 @@ rest of your code continues to run on the battle-tested Zend engine.
8795- ** PHP 8.4 – 8.5** with the ` embed ` module (` libphp.so ` )
8896- ** GCC 9+** (or Clang) with ** C++17**
8997- ** CMake 3.24+**
90- - High-precision math libraries: ** GMP** , ** MPFR** , ** libmpdec**
98+ - High-precision math libraries: ** GMP** , ** MPFR** ( libmpdec is bundled with PHPX)
9199
92100``` shell
93101# Ubuntu/Debian
94- sudo apt install libgmp-dev libmpfr-dev libmpdec-dev
102+ sudo apt install libgmp-dev libmpfr-dev
95103
96104# RHEL/CentOS/Fedora
97- sudo dnf install gmp-devel mpfr-devel libmpdec-devel
105+ sudo dnf install gmp-devel mpfr-devel
98106
99107# Arch Linux
100- sudo pacman -S gmp mpfr mpdecimal
108+ sudo pacman -S gmp mpfr
101109```
102110
103- > GMP powers ` bigInt ` , MPFR powers ` bigFloat ` , and libmpdec powers ` decimal ` .
111+ > GMP powers ` bigInt ` and MPFR powers ` bigFloat ` . The ` decimal ` type is backed
112+ > by libmpdec, which is bundled with PHPX — no separate install required.
104113
105114The preview currently targets ** Linux** as the primary development platform
106115(Ubuntu 22.04 recommended). Windows and macOS packaging is supported through
@@ -340,6 +349,22 @@ See [Mixed C++/PHP](docs/MIXED_CPP_PHP.md).
340349
341350## Benchmark
342351
352+ ### PHP language benchmarks (from php-src)
353+
354+ TypePHP runs the official ` bench.php ` and ` micro_bench.php ` language
355+ benchmarks that ship with the PHP source tree, compiled with ` -O3 ` :
356+
357+ | Benchmark | Interpreted PHP | TypePHP AOT (` -O3 ` ) | Speedup |
358+ | ---| ---| ---| ---|
359+ | ` bench.php ` (total) | 5.034 s | ** 0.603 s** | ~ 8× |
360+ | ` micro_bench.php ` (total) | 13.045 s | ** 2.021 s** | ~ 6.5× |
361+
362+ Both benchmarks measure core PHP language performance — function calls, object
363+ property access, array/hash access, string handling, control flow, and more.
364+ See the full per-item report in [ ` bench.txt ` ] ( bench.txt ) .
365+
366+ ### std::array vs PHP array
367+
343368A 10000×100000 element update loop, comparing PHP arrays against TypePHP's
344369` std::array ` and native C++:
345370
0 commit comments