Commit 0f6b105
committed
Optimize is_awaitable with fast-path for common types
Add a fast-path check for common non-awaitable types (str, int, float,
bool, dict, list, tuple, None, bytes, set, frozenset) before running
the more expensive isinstance and hasattr checks.
Benchmarks show 1.63x speedup for is_awaitable on common values.
Since is_awaitable was ~14% of async execution time, this improves
the async execution path performance.
Also temporarily exclude execute.py from mypyc build due to a mypyc
code generation bug with nested async closures.1 parent dedd185 commit 0f6b105
2 files changed
+24
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
16 | 34 | | |
17 | 35 | | |
18 | 36 | | |
19 | 37 | | |
20 | 38 | | |
21 | 39 | | |
22 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
23 | 46 | | |
24 | 47 | | |
25 | 48 | | |
| |||
0 commit comments