mainframe98 / arc_booster
Arc Booster is a PHP extension aiming to speed up performance of Arcanist, and by extension, Phorge.
Package info
github.com/mainframe98/arc_booster
Language:C
Type:php-ext
Ext name:ext-arc_booster
pkg:composer/mainframe98/arc_booster
Requires
- php: >= 8.4
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-15 14:11:38 UTC
README
Arc Booster is a PHP extension aiming to speed up performance of Arcanist, and by extension, Phorge. It does this by replacing function calls with existing PHP functions, newly added functions, or in some cases completely optimizing the function call away.
Table of Contents
- Requirements
- Installation
- Configuration
- Limitations
- Applied Changes
- Compiling PHP for debugging/running unit tests
Requirements
- PHP 8.4 or newer.
- A reasonably modern release of Arcanist/Phorge.
Optional
- The mbstring extension. If not installed, you should disable
arc_booster.use_mbstring, to prevent Arc Booster from replacing certain function calls with calls to mbstring functions.
Installation
Windows: Use PIE (pie install mainframe98/arc_booster), or download the prebuild Windows DLL from one of the releases. Then, add extension=php_arc_booster.dll to your php.ini file.
Unix (PIE): Run pie install mainframe98/arc_booster and add extension=arc_booster.so to php.ini file.
Unix (Compile): Compile and install the extension as follows.
phpize ./configure make sudo make install
Additionally add extension=arc_booster.so to your php.ini file.
Configuration
Arc Booster declares two ini settings, both of which can only be set in php.ini:
arc_booster.disable_ast_modifications-bool, defaultfalse: Disables AST modification.arc_booster.use_mbstring-bool, defaulttrue: AST replacements usembstringfunctions where applicable.
Limitations
Arc Booster replaces specific Arcanist functions by modifying the abstract syntax tree generated by PHP. This allows for a zero-cost speedup, as the engine does not have to check each individual function call. This does mean, however, that Arc Booster cannot completely identify all function calls that may qualify, as in certain cases, name resolution for functions is context dependent and delayed until runtime.
Arc Booster will only modify qualifying function calls that meet one of the following conditions:
- Are in the global namespace (which is most of Arcanist/Phorge), and aren't imported from another namespace
- Have a
use functionimport, including aliases such asuse function \idx as index, but excludinguse function \index as idx - Are fully qualified (e.g.,
\idx) - Are identifiable through
user_call_funcoruser_call_func_array
Applied Changes
Arc Booster replaces the following functions with native functions provided by PHP:
| Function | Replacement | Notes |
|---|---|---|
head_key |
array_key_first |
|
last_key |
array_key_last |
|
phutil_fwrite_nonblocking_stream |
fwrite |
Modern versions of PHP include the fix that phutil_fwrite_nonblocking_stream addresses. |
phutil_hashes_are_identical |
hash_equals |
|
phutil_is_natural_list |
array_is_list |
Arc Booster replaces the following functions with its own functions:
| Function | Replacement | Notes |
|---|---|---|
idx |
ArcBooster\idx |
Calls with two arguments are replaced by the null-coalescing operator (?? null) |
phutil_string_cast |
ArcBooster\string_cast |
|
phutil_nonempty_string |
ArcBooster\nonempty_string |
|
phutil_nonempty_stringlike |
ArcBooster\nonempty_stringlike |
|
phutil_nonempty_scalar |
ArcBooster\nonempty_scalar |
|
head |
ArcBooster\head |
|
last |
ArcBooster\last |
|
array_mergev |
ArcBooster\array_mergev |
|
array_fuse |
ArcBooster\array_fuse |
Calls without arguments are left untouched, but are supported. |
coalesce |
ArcBooster\coalesce |
|
nonempty |
ArcBooster\nonempty |
|
mpull |
ArcBooster\mpull |
|
ppull |
ArcBooster\ppull |
|
ipull |
ArcBooster\ipull |
|
phutil_utf8ize |
ArcBooster\utf8ize |
|
phutil_is_utf8 |
ArcBooster\is_utf8_slowly |
Only when arc_booster.use_mbstring is disabled. |
phutil_is_utf8_slowly |
ArcBooster\is_utf8_slowly |
|
phutil_utf8v_codepoints |
ArcBooster\utf8v_codepoints |
|
phutil_utf8v |
ArcBooster\utf8v |
Completely removed function calls
| Function | Replacement | Notes |
|---|---|---|
id |
() |
|
idx |
?? null |
Only when the third argument is omitted. |
newv |
new $class_name(...$argv) |
mbstring-specific
These calls are only replaced when arc_booster.use_mbstring is enabled.
| Function | Replacement | Notes |
|---|---|---|
phutil_is_utf8 |
mb_check_encoding |
A second argument is automatically provided. |
phutil_utf8_strlen |
mb_strlen |
A second argument is automatically provided. |
Compiling a minimum PHP build for debugging/running unit tests
Compile PHP with the following (substituting N with the amount of cores to compile with, and PREFIX with the path to store PHP's binaries):
./buildconf ./configure --disable-all --enable-debug --enable-mbstring --disable-mbregex --enable-tokenizer --prefix=<PREFIX> make -jN make install
Then, in this repository, run:
<PREFIX>/bin/phpize ./configure --with-php-config=<PREFIX>/bin/php-config make
To run unit tests:
make test
Alternatively, you can checkout this repository under php-src/ext/ and compile Arc Booster into the PHP binary using --enable-arc_booster when invoking ./configure.
Minimum PHP build for running most Arcanist unit tests
./configure --disable-all --enable-debug --enable-mbstring --disable-mbregex --enable-tokenizer --with-curl --enable-ctype --prefix=<PREFIX>
Then run make install in this directory to make Arc Booster available to the PHP build.
Finally, run arc unit with <PREFIX>/bin/php -dextension=arc_booster.so arcanist/scripts/arcanist.php unit --no-coverage --everything.