[issue32346] Speed up slot lookup for class creation

Antoine Pitrou report at bugs.python.org
Fri Jan 12 06:28:29 EST 2018


Antoine Pitrou <pitrou at free.fr> added the comment:

Serhiy:

> The relative speed up looks nice. But it is just few microseconds per class. You have to create many thousands of classes to gain a significant fraction of second.

This work started with your message in https://mail.python.org/pipermail/python-dev/2017-December/151277.html pointing out that we shouldn't add tp_ slots because it makes type creation and Python initialization slower (*), so I'm a bit surprised that you're now claiming speeding up type creation (by up to 3x!) is not important...

(*) To quote:

'''
2. Increased class initialization time. For every class for every slot 
we need to look up corresponding methods in dictionaries of the class 
itself and all its parents (caching doesn't work fine at this stage). 
Significant part of class initialization time is spent on initializing 
slots. This will increase the startup time and the time of creating 
local classes. The relative overhead is more significant in Cython.
'''

----------

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


More information about the Python-bugs-list mailing list