[New-bugs-announce] [issue43452] Microoptimize PyType_Lookup for cache hits

Dino Viehland report at bugs.python.org
Tue Mar 9 14:21:17 EST 2021


New submission from Dino Viehland <dinoviehland at gmail.com>:

The common case going through _PyType_Lookup is to have a cache hit.  There's some small tweaks which can make this a little cheaper:

1) 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 of the name - instead the address can be used as the hash.

2) 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.

3) If we clear the version tag when invalidating a type then we don't actually need to check for a valid version tag bit.

----------
components: Interpreter Core
messages: 388377
nosy: dino.viehland
priority: normal
severity: normal
status: open
title: Microoptimize PyType_Lookup for cache hits
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43452>
_______________________________________


More information about the New-bugs-announce mailing list