[New-bugs-announce] [issue31336] Speed up _PyType_Lookup() for class creation

Stefan Behnel report at bugs.python.org
Mon Sep 4 07:39:18 EDT 2017

New submission from Stefan Behnel:

The method lookup fast path in _PyType_Lookup() does not apply during type creation, which is highly dominated by the performance of the dict lookups along the mro chain. Pre-calculating the name hash speeds up the creation of an empty class (i.e. "class Test: pass") by around 20%.

Will send a pull request shortly.

components: Interpreter Core
messages: 301213
nosy: scoder
priority: normal
severity: normal
status: open
title: Speed up _PyType_Lookup() for class creation
type: performance
versions: Python 3.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list