pluggy icon indicating copy to clipboard operation
pluggy copied to clipboard

faster baseline import

Open RonnyPfannschmidt opened this issue 2 years ago • 4 comments

still breaking

this change youelds a speedup form 0.69s to 0.004s for pluggy imports, by deferring imports of the stdlib

RonnyPfannschmidt avatar Sep 19 '23 20:09 RonnyPfannschmidt

@nicoddemus @bluetech i wonder if we can drop the custom parsing from pytest (for marks on hooks) else there is need for a _types module that gets lazyly imported using getattr

RonnyPfannschmidt avatar Sep 20 '23 09:09 RonnyPfannschmidt

i also started https://discuss.python.org/t/deferred-computation-evalution-for-toplevels-imports-and-dataclasses/34173 as a result of this

RonnyPfannschmidt avatar Sep 20 '23 09:09 RonnyPfannschmidt

hmm, i strongly dislike the current structure of this the proposal for python is also going nowhere

i strongly suspect that unless apipkg provides a example something similar wont go forward

RonnyPfannschmidt avatar Sep 22 '23 17:09 RonnyPfannschmidt

Deferring typing seems like too much to me...

Looking at python -Ximporttime output, importlib.metadata is a major culprit. Making it lazy (which is simpler to do) reduces the import time ~70ms -> ~30ms for me. I think we should start with this and maybe other simple imports if any and then evaluate typing separately.

bluetech avatar Sep 24 '23 13:09 bluetech