4 ms·
Times I've profiled large tests suites / codebases in the past, this has been entirely down to import overheads. Quite a difficult thing to fix ... I'm hoping
by Jackevansevo 4y ago
Times I've profiled large tests suites / codebases in the past, this has been entirely down to import overheads. Quite a difficult thing to fix ...
I'm hoping this PEP Proposal for lazy imports might solve things: https://peps.python.org/pep-0690/ https://peps.python.org/pep-0690/
Try profiling pytest with something like pyinstrument[1] and make sure you invoke it from python directly[2] with `--collect-only` as an argument. You'll essentially then just be profiling the import overheads before tests are ran.
[1] - https://pyinstrument.readthedocs.io/en/latest/guide.html#profile-a-specific-chunk-of-code https://pyinstrument.readthedocs.io/en/latest/guide.html#pro...
[2] - https://pyinstrument.readthedocs.io/en/latest/guide.html#profile-a-specific-chunk-of-code https://pyinstrument.readthedocs.io/en/latest/guide.html#pro...
- cocoflunchy 4y agoThanks, pyinstrument is really nice. You're right it looks like imports are taking a lot of time...