Yes, thankfully the enum import is less expensive in 3.14 - down from ~8ms in 3.13 to ~3ms locally due to the import deferrals but most of the rest of the import time is in the actual body of the module.
Removing the functools
and ast
imports may still be worth doing in annotationlib
.
With deferral of both and converting annotationlib to a package:
import time: self [us] | cumulative | imported package
...
import time: 426 | 426 | types
import time: 1856 | 2281 | enum
import time: 187 | 187 | keyword
import time: 1289 | 3757 | annotationlib
Without:
import time: self [us] | cumulative | imported package
...
import time: 1672 | 1672 | _ast
import time: 640 | 2312 | ast
import time: 335 | 335 | types
import time: 2424 | 2759 | enum
import time: 231 | 231 | itertools
import time: 359 | 359 | keyword
import time: 214 | 214 | _operator
import time: 933 | 1147 | operator
import time: 1889 | 1889 | reprlib
import time: 571 | 571 | _collections
import time: 2832 | 7026 | collections
import time: 528 | 528 | _functools
import time: 2401 | 9954 | functools
import time: 2522 | 17545 | annotationlib
Should I make a PR? Would it need a specific open issue first, or just against Improve import time of various stdlib modules · Issue #118761 · python/cpython · GitHub