-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SingleFileSourceLocator is too ineffective about unknown identifiers #614
Comments
My PoC implementation that works well: https://github.com/phpstan/phpstan-src/blob/master/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocator.php |
Possibly related to how the BetterReflection/src/SourceLocator/Type/AbstractSourceLocator.php Lines 39 to 49 in 5b2a0a7
BetterReflection/src/SourceLocator/Type/AbstractSourceLocator.php Lines 52 to 59 in 5b2a0a7
Note how the entire source is re-created each time: BetterReflection/src/SourceLocator/Type/SingleFileSourceLocator.php Lines 36 to 49 in 5b2a0a7
We can most likely avoid the expensive I/O operations ( Still, the BetterReflection/src/SourceLocator/Ast/Locator.php Lines 58 to 69 in 5b2a0a7
|
When asked about an unknown identifier, it always parses the source code again.
Instead, it should parse the file only a single time and remember all the parsed symbols.
I know there's MemoizingSourceLocator but it doesn't help really. It will only remember
null
when asked about the same identifiers for the second time.The text was updated successfully, but these errors were encountered: