-
Notifications
You must be signed in to change notification settings - Fork 671
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
Performance only load files once #8011
Conversation
248d1f0
to
17a8426
Compare
* use static to keep opened files with content * move position of file cache population to the place where we read files to ensure cache always gets populated and not on open only (since it's called directly in some places)
17a8426
to
06178d0
Compare
741c32e
to
278e877
Compare
Can you double check memory usage? I'd expect the parsed structures to be much bigger than file contents, but this will definitely increase memory usage and it wouldn't be bad to double check. I assume this code is bypassed for the language server, but that would be good to verify as well. |
The memory usage depends on what you are checking, as the memory usage is directly proportional to the number and size of files analyzed. If real world tests show that memory consumption is too high, we could offer an option to I tested it on the WP core repo and the memory usage was only slightly higher than before. |
Yeah, that's what I expected, just wanted to confirm with an actual test. I do want to double check how the language server works though. If the language server relies on this class then the caching could completely break it, unless it's only used to get initial file state in which case the cache is just wasting memory. |
Language server should also support the usecase when the file is not saved yet, so it shouldn't rely really on files on disk anyway. |
Could someone merge this? |
Thanks! |
Fixes #8008
Speeds up psalm between 5-15%.
Also fixes an issue on Unix systems where A.php and a.php were treated equal, even though they are different files, since unix file names are case sensitive.