Skip to content
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

Various minor improvements to speed up by ~10% #8193

Merged
merged 5 commits into from Jun 28, 2022

Conversation

kkmuffme
Copy link
Contributor

Improve various minor things to speed up psalm performance by about 10%

No negative impact on memory consumption.

Will invalidate old caches (= most cache files created with any previous psalm versions will not be used anymore and new caches will be created on first run, since the cache hash changed for performance reasons)

@kkmuffme kkmuffme force-pushed the improve-psalm-performance branch 2 times, most recently from 02fe7f8 to 3fd96be Compare June 28, 2022 18:33
* check isset for all elements first, as array_diff is much more expensive
* Improves performance by 1%
* sort is much more expensive than count, so we only sort if we have something to sort
* could implement for ksort too, but advantage there is minimal since we almost always have more than 1 possibility
* use same hash algorithm as in other places (= faster)
* reduces runtime by 2-3%
improves performance by ~1-1.5%
* do not concatenate with timestamp as this is slow, since $file_contents may be big
* use file contents not file path for cache hash only to ensure it works if file_path not set but file_content is
* improves performance by ~5%
* reduces I/O by 30%
* minimal performance improvement (<0.5%)
@kkmuffme kkmuffme force-pushed the improve-psalm-performance branch 4 times, most recently from f917bca to 9058608 Compare June 28, 2022 20:07
@kkmuffme
Copy link
Contributor Author

Branch is ready to be merged.

Sorry for many force push, but the tests don't work for me locally. Some step by step guidance/link on how to run the tests locally (or where the composer is installed, even when on a remote server) would be appreciated.

@AndrolGenhald
Copy link
Collaborator

@kkmuffme I use vendor/bin/paratest -f --max-batch-size=16 (tweak batch size to see what's fastest for your hardware), we probably should document that somewhere. Note that you may have to disable the callmap test due to #8162, I haven't had time to look into that yet.

@orklah orklah added the release:internal The PR will be included in 'Internal changes' section of the release notes label Jun 28, 2022
@orklah orklah merged commit 4bc803d into vimeo:4.x Jun 28, 2022
@orklah
Copy link
Collaborator

orklah commented Jun 28, 2022

Thanks!

@kkmuffme kkmuffme deleted the improve-psalm-performance branch June 28, 2022 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:internal The PR will be included in 'Internal changes' section of the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants