Skip to content

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Oct 14, 2023

tested with

blackfire run --ignore-exit-status php vendor/bin/phpunit tests/PHPStan/Analyser/NodeScopeResolverTest.php

before this PR: (1.10.x@7c4ef6b2a)

I/O Wait      171ms
CPU Time   2min 13s
Memory        368MB
Wall Time  2min 13s
Network         n/a     n/a     n/a
SQL             n/a     n/a

after this PR:

Wall Time  2min 16s
I/O Wait      183ms
CPU Time   2min 16s
Memory        345MB
Network         n/a     n/a     n/a
SQL             n/a     n/a
grafik

@@ -42,12 +40,11 @@ public function createByDirectory(string $directory): NewOptimizedDirectorySourc
$files = $this->fileFinder->findFiles([$directory])->getFiles();
$fileHashes = [];
foreach ($files as $file) {
try {
$contents = FileReader::read($file);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are more places that do the same thing, please check ResultCacheManager. Or all the places that use FileReader. Thanks.

@@ -789,10 +789,7 @@ private function getFileHash(string $path): string
return $this->fileHashes[$path];
}

$contents = FileReader::read($path);
$contents = str_replace("\r\n", "\n", $contents);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here was some normalization going on. removing it did not break tests.

I assume the result cache is not meant to be shared across different computers, therefore it seems not necessary

@ondrejmirtes ondrejmirtes merged commit bd3f7f3 into phpstan:1.10.x Oct 14, 2023
@ondrejmirtes
Copy link
Member

Thank you.

@staabm staabm deleted the exp-mem branch October 14, 2023 19:21
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.

2 participants