Commit ee48c7d
authored
bpo-43452: Micro-optimizations to PyType_Lookup (GH-24804)
The common case going through _PyType_Lookup is to have a cache hit. There are some small tweaks that can make this a little cheaper:
* The name field identity is used for a cache hit and is kept alive by the cache. So there's no need to read the hash code o the name - instead, the address can be used as the hash.
* There's no need to check if the name is cachable on the lookup either, it probably is, and if it is, it'll be in the cache.
* If we clear the version tag when invalidating a type then we don't actually need to check for a valid version tag bit.1 parent 2fd16ef commit ee48c7d
2 files changed
Lines changed: 24 additions & 28 deletions
File tree
- Misc/NEWS.d/next/Core and Builtins
- Objects
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
| 35 | + | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
| |||
338 | 337 | | |
339 | 338 | | |
340 | 339 | | |
| 340 | + | |
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
| |||
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
| 399 | + | |
399 | 400 | | |
400 | 401 | | |
401 | 402 | | |
| |||
3351 | 3352 | | |
3352 | 3353 | | |
3353 | 3354 | | |
3354 | | - | |
3355 | | - | |
3356 | | - | |
3357 | | - | |
3358 | | - | |
3359 | | - | |
3360 | | - | |
| 3355 | + | |
| 3356 | + | |
| 3357 | + | |
| 3358 | + | |
| 3359 | + | |
3361 | 3360 | | |
3362 | | - | |
| 3361 | + | |
3363 | 3362 | | |
3364 | | - | |
3365 | | - | |
| 3363 | + | |
3366 | 3364 | | |
3367 | 3365 | | |
3368 | 3366 | | |
| |||
3385 | 3383 | | |
3386 | 3384 | | |
3387 | 3385 | | |
3388 | | - | |
3389 | | - | |
3390 | | - | |
3391 | | - | |
3392 | | - | |
3393 | | - | |
3394 | | - | |
3395 | | - | |
| 3386 | + | |
| 3387 | + | |
| 3388 | + | |
| 3389 | + | |
| 3390 | + | |
| 3391 | + | |
3396 | 3392 | | |
3397 | | - | |
3398 | | - | |
3399 | | - | |
3400 | | - | |
3401 | | - | |
3402 | | - | |
3403 | | - | |
3404 | | - | |
| 3393 | + | |
| 3394 | + | |
3405 | 3395 | | |
| 3396 | + | |
| 3397 | + | |
| 3398 | + | |
| 3399 | + | |
| 3400 | + | |
3406 | 3401 | | |
3407 | 3402 | | |
3408 | 3403 | | |
| |||
0 commit comments