-
Notifications
You must be signed in to change notification settings - Fork 659
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
Clarify documentation of --diff and --diff-methods #2680
Conversation
|
||
Data from the last run is stored in the *cache directory*, which may be set in [configuration](./configuration.md). | ||
If you are running Psalm on a build server, you may want to configure the server to ensure that the cache directory | ||
is preserved between runs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to try doing this for Psalm's own CircleCI config.
- `--diff` which only checks files you’ve updated (and their dependents). | ||
- `--diff-methods` which remembers Psalm’s output when scanning particular methods. | ||
- `--diff` which only checks files you’ve updated since the last run (and their dependents). | ||
- `--diff-methods` which only checks methods you’ve updated since the last run (and their dependents). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to add something about why these are optional and not always on. I haven't been using them up to now, but I don't actually know in what use case it's better to have them switched off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@muglug said he intends to enable those flags by default:
https://twitter.com/psalmphp/status/1220126747175325696
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I don't know if there'll still be a reason for some users to turn them off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had them on at Vimeo, and ran into essentially impossible-to-reproduce bugs in CI when running with --find-unused-code
. But our CI is different now and it should be much easier to reproduce issues, so I'll soon be turning it back on and monitoring for a while.
Running Psalm on my local on it's own codebase I don't actually see much difference in speed between with and without |
Doing the same here I get: $ ./psalm --clear-cache
Cache directory deleted
$ ./psalm --threads=8 --show-info=false
Scanning files...
Analyzing files...
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 60 / 762 (7%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 120 / 762 (15%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 180 / 762 (23%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 240 / 762 (31%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 300 / 762 (39%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 360 / 762 (47%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 420 / 762 (55%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 480 / 762 (62%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 540 / 762 (70%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 600 / 762 (78%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 660 / 762 (86%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 720 / 762 (94%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
------------------------------
No errors found!
------------------------------
15 other issues found.
------------------------------
Checks took 23.81 seconds and used 515.054MB of memory
Psalm was able to infer types for 99.8332% of the codebase
$ ./psalm --threads=8 --show-info=false --diff --diff-methods
Scanning files...
Analyzing files...
------------------------------
No errors found!
------------------------------
15 other issues found.
------------------------------
Checks took 2.62 seconds and used 495.469MB of memory
No files analyzed |
@weirdan ok so a |
ca0c29e
to
cbed49c
Compare
Master is currently failing, so I've rebased this PR onto 947765c - the last passing commit from master. |
Caching in CircleCI only seems to save about two seconds, so maybe isn't worth it: compare https://app.circleci.com/jobs/github/bdsl/psalm/886 in which the cache cannot be loaded because it hasn't been saved yet, and https://app.circleci.com/jobs/github/bdsl/psalm/889 which loaded a cache. The Psalm run was 13.96s in the former and 11.91s in the latter. Maybe would need a bigger codebase to show the benefit. Feel free to take just the first commit from this PR. |
56073fc
to
410c72a
Compare
Looking at the code I suspect caching just doesn't really work for Psalm CI environment. E.g. psalm/src/Psalm/Internal/Provider/ClassLikeStorageCacheProvider.php Lines 124 to 127 in 0ffb833
And $this->timestamps includes modification times of some Psalm's files:psalm/src/Psalm/Internal/Provider/ClassLikeStorageCacheProvider.php Lines 45 to 52 in 0ffb833
as well as Psalm's version (with the commit hash):
For Psalm's self-check it's version as well as file mtimes will almost always differ from the previous run, because we're checking another commit. |
Thanks! |
No description provided.