Skip to content

Commit

Permalink
Do not use JIT on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Jan 17, 2024
1 parent 67c7be3 commit d2c3f89
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Psalm/Internal/Cli/Psalm.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
use function array_values;
use function chdir;
use function count;
use function defined;
use function extension_loaded;
use function file_exists;
use function file_put_contents;
Expand Down Expand Up @@ -898,7 +899,7 @@ private static function restart(array $options, int $threads, Progress $progress
// If Xdebug is enabled, restart without it
$ini_handler->check();

if (!function_exists('opcache_get_status')) {
if (!function_exists('opcache_get_status') && !defined('PHP_WINDOWS_VERSION_MAJOR')) {
$progress->write(PHP_EOL
. 'Install the opcache extension to make use of JIT for a 20%+ performance boost!'
. PHP_EOL . PHP_EOL);
Expand Down
5 changes: 3 additions & 2 deletions src/Psalm/Internal/Fork/PsalmRestarter.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use function array_merge;
use function array_splice;
use function assert;
use function defined;
use function extension_loaded;
use function file_get_contents;
use function file_put_contents;
Expand Down Expand Up @@ -81,7 +82,7 @@ protected function requiresRestart($default): bool

$opcache_loaded = extension_loaded('opcache') || extension_loaded('Zend OPcache');

if ($opcache_loaded) {
if ($opcache_loaded && !defined('PHP_WINDOWS_VERSION_MAJOR')) {
// restart to enable JIT if it's not configured in the optimal way
foreach (self::REQUIRED_OPCACHE_SETTINGS as $ini_name => $required_value) {
$value = (string) ini_get("opcache.$ini_name");
Expand Down Expand Up @@ -155,7 +156,7 @@ protected function restart($command): void
// executed in the parent process (before restart)
// if it wasn't loaded then we apparently don't have opcache installed and there's no point trying
// to tweak it
if ($opcache_loaded) {
if ($opcache_loaded && !defined('PHP_WINDOWS_VERSION_MAJOR')) {
$additional_options = [];
foreach (self::REQUIRED_OPCACHE_SETTINGS as $key => $value) {
$additional_options []= "-dopcache.{$key}={$value}";
Expand Down

0 comments on commit d2c3f89

Please sign in to comment.