ripe-cpu-85141
08/08/2022, 8:58 PMenough-analyst-54434
08/08/2022, 9:05 PMripe-cpu-85141
08/08/2022, 9:19 PMripe-cpu-85141
08/08/2022, 9:20 PMripe-cpu-85141
08/08/2022, 9:20 PMripe-cpu-85141
08/08/2022, 9:21 PMenough-analyst-54434
08/08/2022, 9:42 PMripe-cpu-85141
08/08/2022, 10:24 PMripe-cpu-85141
08/08/2022, 10:25 PMenough-analyst-54434
08/08/2022, 11:04 PM./pants --no-process-cleanup test --force ...
. That will force a run of your tests and print out a line like:
./pants --no-process-cleanup test --force src/python/pants/util/strutil_test.py
16:00:55.92 [INFO] Preserving local process execution dir /tmp/pants-sandbox-ZCERnv for Run Pytest for src/python/pants/util/strutil_test.py:tests
16:00:56.27 [INFO] Completed: Run Pytest - src/python/pants/util/strutil_test.py:tests succeeded.
✓ src/python/pants/util/strutil_test.py:tests succeeded in 0.29s.
You can then use / edit the __run.sh
script in the printed out /tmp/pants-sandbox-*
directory to start drilling down on timings.enough-analyst-54434
08/09/2022, 12:12 AM__run.sh
script:
$ diff /tmp/pants-sandbox-ZCERnv/__run.sh.orig /tmp/pants-sandbox-ZCERnv/__run.sh
5c5
< ./pytest_runner.pex_pex_shim.sh --no-header src/python/pants/util/strutil_test.py
---
> ./pytest_runner.pex_pex_shim.sh src/python/pants/util/strutil_test.py "$@"
And then I could:
$ hyperfine '/tmp/pants-sandbox-ZCERnv/__run.sh --collect-only'
Benchmark 1: /tmp/pants-sandbox-ZCERnv/__run.sh --collect-only
Time (mean ± σ): 170.3 ms ± 2.5 ms [User: 149.4 ms, System: 20.9 ms]
Range (min … max): 166.1 ms … 174.6 ms 17 runs
$ hyperfine /tmp/pants-sandbox-ZCERnv/__run.sh
Benchmark 1: /tmp/pants-sandbox-ZCERnv/__run.sh
Time (mean ± σ): 249.1 ms ± 2.8 ms [User: 225.6 ms, System: 23.3 ms]
Range (min … max): 246.2 ms … 254.8 ms 12 runs
So, in this case, I can see collection overhead is roughly 70% of runtime. That's not really fair attribution since collection takes the import hit and importing has to happen anyway, but hopefully this makes clear how you can drill in on what's going on. If you can't track down what's taking so long using this technique, an implication can be its the overhead of pants setting up this sandbox that is the slow part. I'm not sure we give you an easy way to see that overhead timing.ripe-cpu-85141
08/09/2022, 12:30 AMripe-cpu-85141
08/12/2022, 3:44 PM