Skip to content

Commit 5b784ad

Browse files
committed
YUUUUUUUGE performance improvement for full analysis with heavily populated cache
this change reduces full analysis time of pmmp/PocketMine-MP from 33sec to 13sec (no result cache)
1 parent 635c256 commit 5b784ad

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/Command/CommandHelper.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ public static function begin(
4848
bool $manageMemoryLimitFile = true,
4949
bool $debugEnabled = false,
5050
?string $singleReflectionFile = null,
51-
?string $singleReflectionInsteadOfFile = null
51+
?string $singleReflectionInsteadOfFile = null,
52+
bool $cleanupContainerCache = true
5253
): InceptionResult
5354
{
5455
if (!$allowXdebug) {
@@ -257,7 +258,9 @@ public static function begin(
257258
throw new \PHPStan\Command\InceptionNotSuccessfulException();
258259
}
259260

260-
$containerFactory->clearOldContainers($tmpDir);
261+
if ($cleanupContainerCache) {
262+
$containerFactory->clearOldContainers($tmpDir);
263+
}
261264

262265
if (count($paths) === 0) {
263266
$errorOutput->writeLineFormatted('At least one path must be specified to analyse.');

src/Command/WorkerCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
111111
$allowXdebug,
112112
false,
113113
false,
114-
$singleReflectionFile
114+
$singleReflectionFile,
115+
null,
116+
false
115117
);
116118
} catch (\PHPStan\Command\InceptionNotSuccessfulException $e) {
117119
return 1;

0 commit comments

Comments
 (0)