Skip to content

Disable JIT by default, make it opt-in via --force-jit#1

Open
alies-dev wants to merge 1 commit into6.xfrom
disable-jit-by-default
Open

Disable JIT by default, make it opt-in via --force-jit#1
alies-dev wants to merge 1 commit into6.xfrom
disable-jit-by-default

Conversation

@alies-dev
Copy link
Owner

@alies-dev alies-dev commented Feb 25, 2026

Summary

Disable JIT by default and make it opt-in via the existing --force-jit flag / forceJit config option.

Recent PHP JIT changes (bug fixes and refactors that increased compilation times) have shifted the performance tradeoff — as confirmed by @danog's own benchmarks in vimeo#11589. Additionally, JIT causes segfaults (exit code 139) during taint analysis on certain platforms due to PHP core JIT bugs (php/php-src#17858, php/php-src#13180).

Changes

  • PsalmRestarter: Split REQUIRED_OPCACHE_SETTINGS into base opcache settings (always applied) and JIT_OPCACHE_SETTINGS (only applied when enableJit is true)
  • Psalm.php: Pass forceJit to the restarter; JIT status messages only shown when --force-jit is set
  • Docs: Updated forceJit description to reflect it now enables JIT rather than just guarding availability

What stays the same

  • Opcache is still always enabled and optimized
  • --force-jit / forceJit="true" works exactly as before for users who want JIT
  • Preloading behavior unchanged
  • No new flags — the existing forceJit naturally becomes the opt-in

DX

Default psalm just works — no JIT overhead, no segfaults, no misleading messages. Users who want JIT explicitly opt in.

Related PRs

Open for discussion

This is a PoC — the default behavior is open for discussion. For example, instead of a simple on/off, forceJit could support three modes:

  • auto (default) — enable JIT when available, fall back gracefully if not
  • on — always enable JIT, exit if unavailable (current --force-jit behavior)
  • off — never enable JIT

Happy to iterate on the approach.

Benchmarks across multiple platforms (Windows, Linux, macOS) and
codebases consistently show JIT hurting Psalm performance by 5-35%.
Additionally, JIT causes segfaults during taint analysis on certain
platforms due to PHP core JIT bugs.

Split opcache settings into base (always applied) and JIT-specific
(only applied when --force-jit or forceJit="true" is set). This
keeps opcache optimizations while avoiding JIT overhead and
instability by default.

Refs vimeo#11589, vimeo#11613
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant