I mean, typing isn’t used by most people for it’s runtime effects. any amount of time is slow for it, and it feels less excusable when it’s mostly possible to use the typing annotations without ever importing typing[1], and this is felt most in things that aren’t long-lived applications or are scaled on demand. I’ve got some actual timing underway and will be following up in another thread about improving import time in general once I have about a week’s worth of data (the initial start of collection was delayed).
Edit: to be clear, I don’t know that the pattern linked should be the answer, it works currently, but long term I’d love to see it “just work performantly” as people would expect for something meant to have no real effect in most cases, and not be noticeably slow enough that people feel the need to work around the import.
With only a few exceptions currently, it’s possible to defer this import via a module getattr, and the import won’t ever happen unless annotations are inspected. A public example of this has been shared before here, so it is only paid for if needed. This pattern is used extensively, including in some forked dependencies at my day job. ↩︎