static-php-cli icon indicating copy to clipboard operation
static-php-cli copied to clipboard

Apply micro patches only when building micro

Open henderkes opened this issue 6 months ago • 5 comments

Most users will probably never use micro. No reason to apply their specific patches that may influence or break other things.

henderkes avatar Jul 30 '25 14:07 henderkes

Disabling huge pages also negatively affects performance. The others are simply superfluous if not needed.

henderkes avatar Jul 30 '25 15:07 henderkes

Most users will probably never use micro.

I don't agree. The SPC binary itself is using micro. Many developers for CLI developing may find to here firstly and already been used widely. The original purpose of this project was to improve the build process of phpmicro.

No reason to apply their specific patches that may influence or break other things.

I agree. Some patches should be used when building with --build-micro only, but I'll leave current SPC_MICRO_PATCHES in current main branch. We could change this env behavior in 3.0.

Disabling huge pages also negatively affects performance.

Indeed. We could remove disable_huge_pages in default ini configs later.

The others are simply superfluous if not needed.

  • cli_checks is necessary for calling many extension functions in micro SAPI properly, keeping it should have no impact.
  • Windows required patches cannot be removed for php.exe builds.
  • static_opcache will be used when including opcache extension for PHP <= 8.4.
  • phar will be used when building micro with phar extension.
  • macos_iconv looks redundant for now, I'll remove it later.

crazywhalecc avatar Jul 30 '25 15:07 crazywhalecc

I would say we keep the patch, but generally change patches to only happen when actually using functionality that requires them. Huge pages amounted to a good ~4% performance and it took me 3 days to find it because I was using the source/php-src folder to configure manually.

henderkes avatar Jul 30 '25 16:07 henderkes

To reduce downloading and dependencies, I think we could move micro patches into SPC's source to maintain. StaticPHP uses forked phpmicro, which is actually a completely version we maintaining.

After doing this we can download micro SAPI when building micro.sfx only.

crazywhalecc avatar Nov 29 '25 09:11 crazywhalecc

We should only copy over the patches that are required to make php compilation work for cli/fpm/etc. without micro. On linux and macos, none of the patches are required for 8.5. For <= 8.4 we only need static_opcache patch.

henderkes avatar Nov 29 '25 09:11 henderkes