Commit 5f5a31f
committed
Micro-optimize check_isinstance.
- If a single type is passed in, save an iteration over a tuple.
- Don't compute the type names for the error message unless an error
actually occurred.
Together, this speeds up `_check_isinstance(int, x=1)` by more than
2-fold, and `_check_isinstance((float, int), x=1)` by a few dozen-%.1 parent e079bd3 commit 5f5a31f
1 file changed
+10
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2241 | 2241 | | |
2242 | 2242 | | |
2243 | 2243 | | |
2244 | | - | |
2245 | | - | |
2246 | | - | |
2247 | | - | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
2248 | 2248 | | |
2249 | 2249 | | |
2250 | | - | |
| 2250 | + | |
| 2251 | + | |
2251 | 2252 | | |
2252 | 2253 | | |
2253 | | - | |
2254 | | - | |
2255 | | - | |
2256 | | - | |
2257 | 2254 | | |
2258 | 2255 | | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
2259 | 2260 | | |
2260 | 2261 | | |
2261 | 2262 | | |
| |||
0 commit comments