fast-byte-97321
04/28/2024, 5:53 AMpants check ::
is much slower (~10 seconds) than running the type checker (pyright
) directly (~1.5 seconds).
$ time pants check ::
08:49:58.47 [INFO] Canceled: Force venv to materialize
08:49:58.71 [INFO] Completed: Force venv to materialize
08:50:09.19 [INFO] Completed: Run Pyright on 8 files.
08:50:09.19 [ERROR] Completed: Typecheck using Pyright - pyright - pyright failed (exit code 1).
calculations/adder.py
calculations/adder.py:3:5 - error: "x" is not defined (reportUndefinedVariable)
1 error, 0 warnings, 0 informations
ā pyright failed.
pants check :: 0.01s user 0.03s system 0% cpu 11.013 total
⯠time pyright
calculations/adder.py
calculations/adder.py:3:5 - error: "x" is not defined (reportUndefinedVariable)
1 error, 0 warnings, 0 informations
pyright 0.59s user 0.14s system 55% cpu 1.309 total
Is this to be expected? Am I missing something around caching or setup? š¤
Any advise greatly appreciatedhappy-kitchen-89482
04/28/2024, 6:04 AMpants check ::
after a failure?happy-kitchen-89482
04/28/2024, 6:04 AMfast-byte-97321
04/28/2024, 9:41 AMpantsd
background process it takes ~25 seconds for the first run. Then ~10 seconds every time after that.happy-kitchen-89482
04/28/2024, 10:13 AMhappy-kitchen-89482
04/28/2024, 10:14 AMfast-byte-97321
04/28/2024, 5:00 PM$ time pyright
added 2 packages, and audited 3 packages in 1s
found 0 vulnerabilities
calculations/adder.py
calculations/adder.py:3:5 - error: "t" is not defined (reportUndefinedVariable)
1 error, 0 warnings, 0 informations
pyright 1.90s user 1.01s system 95% cpu 3.056 total
fast-byte-97321
04/28/2024, 5:01 PMpants check ::
was slightly faster after removing the pyright cache š
time pants check ::
20:00:53.07 [INFO] Canceled: Force venv to materialize
20:00:53.72 [INFO] Completed: Force venv to materialize
20:01:01.43 [INFO] Completed: Run Pyright on 8 files.
20:01:01.43 [ERROR] Completed: Typecheck using Pyright - pyright - pyright failed (exit code 1).
calculations/adder.py
calculations/adder.py:3:5 - error: "t" is not defined (reportUndefinedVariable)
1 error, 0 warnings, 0 informations
ā pyright failed.
pants check :: 0.01s user 0.01s system 0% cpu 8.569 total
wide-midnight-78598
04/28/2024, 5:18 PM-ldebug
?
I'm curious if any of the intermediate steps between forcing the venv to materialize, and the process running are in the logs - we might be missing a caching step in there.
Also, if you keep the sandbox and run the pyright script directly from there, is it any faster?wide-midnight-78598
04/28/2024, 5:28 PMnpx pyright ...
is about 2x faster than pants check ::
(not 1:1, but definitely close enough for this)
Running it via the sandbox is just under 2x slower - but I also noticed that by default we're using node 16? And my system is on node 22 or something, I believe there must be some sort of improvements there.
Also, via npx I'm using pyright 1.1.360
and pants is using 1.1.316
by defaultwide-midnight-78598
04/28/2024, 5:32 PM[nodejs]
version = "v22.0.0"
fast-byte-97321
04/28/2024, 5:34 PMForce venv to materialize
step. It completes almost immediately and then I get the following timer:
20:32:22.00 [INFO] Completed: Force venv to materialize
ā 2.76s Run Pyright on 8 files.
I'm not getting any extra output with -ldebug
š¤
⯠time pants -ldebug check ::
20:34:01.01 [INFO] Completed: Force venv to materialize
20:34:07.71 [INFO] Completed: Run Pyright on 8 files.
20:34:07.71 [ERROR] Completed: Typecheck using Pyright - pyright - pyright failed (exit code 1).
calculations/adder.py
calculations/adder.py:3:5 - error: "t" is not defined (reportUndefinedVariable)
1 error, 0 warnings, 0 informations
ā pyright failed.
pants -ldebug check :: 0.01s user 0.01s system 0% cpu 7.180 total
fast-byte-97321
04/28/2024, 5:35 PMAlso, if you keep the sandbox and run the pyright script directly from there, is it any faster?I'm afraid I'm new to pants. How should I do this?
fast-byte-97321
04/28/2024, 5:36 PM$ find . -name '*.py' | wc -l
8
It's just a small test project to play around with pantswide-midnight-78598
04/28/2024, 5:37 PMtime pants --keep-sandboxes=on_failure check ::
With debugging (pretty verbose)
time pants -ldebug --keep-sandboxes=on_failure check ::
That'll give you something like
13:25:23.12 [INFO] Preserving local process execution dir /private/var/folders/dy/q08y_dts5vd71rm99t4gc9lr0000gp/T/pants-sandbox-aFigFs for Run Pyright on 5 files.
Then you can cd into the directory, and run sh __run.sh
wide-midnight-78598
04/28/2024, 5:38 PMThe number of files in this project is tiny btwYep, saw that, I made an equally small repo at like 3-5 files - I'm seeing 1-2 seconds, so 10s is blowing my mind. 𤯠Even in my trivial case with the 20% overhead, I still think that's too much for a re-run of what should be fully cached info.
wide-midnight-78598
04/28/2024, 5:39 PM[nodejs]
version = "v22.0.0"
Even if you don't keep it like that, it'll help figure out what the perf causes might be. Also, I do think Pants should bump the defaults anywayswide-midnight-78598
04/28/2024, 5:45 PMpyright
execution time on my machine is almost the same as running it via npx
- probably within run-to-run variance. The rest of the time is pants itself going through rule selection and stuff... š¤·
Using
[GLOBAL]
pants_version = "2.19.1"