mirror of
https://github.com/python/cpython
synced 2024-09-20 23:31:42 +00:00
gh-109653: Speedup import of threading module (#114509)
Avoiding an import of functools leads to 50% speedup of import time. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
parent
c8cf5d7d14
commit
5e390a0fc8
|
@ -3,7 +3,6 @@
|
|||
import os as _os
|
||||
import sys as _sys
|
||||
import _thread
|
||||
import functools
|
||||
import warnings
|
||||
|
||||
from time import monotonic as _time
|
||||
|
@ -1630,8 +1629,7 @@ def _register_atexit(func, *arg, **kwargs):
|
|||
if _SHUTTING_DOWN:
|
||||
raise RuntimeError("can't register atexit after shutdown")
|
||||
|
||||
call = functools.partial(func, *arg, **kwargs)
|
||||
_threading_atexits.append(call)
|
||||
_threading_atexits.append(lambda: func(*arg, **kwargs))
|
||||
|
||||
|
||||
from _thread import stack_size
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Reduce the import time of :mod:`threading` module by ~50%. Patch by Daniel Hollas.
|
Loading…
Reference in a new issue