Commit cb15300
authored
Lazy import asyncio.sleep as it's expensive (#450)
On my system, importing tenacity (_without tornado_) takes 35ms, and
asyncio is singlehandedly responsible for 15ms. Some users do not ever
use AsyncRetrying (or asyncio in their project generally) and it would
be a shame for them to incur a unnecessary import penalty.
Full disclaimer: I pursued this change primarily to reduce pip's startup
time where asyncio was a nontrivial portion of the import timeline.1 parent c5d2d8b commit cb15300
1 file changed
+10
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
34 | 40 | | |
35 | 41 | | |
36 | 42 | | |
37 | 43 | | |
38 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
39 | 47 | | |
40 | 48 | | |
41 | 49 | | |
| |||
0 commit comments