vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.54k stars 660 forks source link

Speed up tests by not loading stubs for many of them #7779

Open muglug opened 2 years ago

muglug commented 2 years ago

Lots of tests don't need stubs. tests/SwitchTypeTest.php becomes about 5x faster when stubs loading is turned off.

We should annotate individual tests to encode the ones that pass without stubs.

AndrolGenhald commented 2 years ago

I was actually doing this in a branch at one point for some new tests I added but I think I ended up discarding it. I wonder if a better idea would be to allow caching stubs for tests? That way performance would also be improved for the many tests that do need the stubs.

muglug commented 2 years ago

Caching isn't really possible, as loading those stubs is part of the static reflection Psalm does each time.