This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients pitrou, scoder, serhiy.storchaka
Date 2017-12-16.12:21:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1513426878.39.0.213398074469.issue32346@psf.upfronthosting.co.za>
In-reply-to
Content
As mentioned in https://mail.python.org/pipermail/python-dev/2017-December/151298.html, slot lookup can take 75 to 80% of the runtime when creating a new class.  This was slightly improved in https://bugs.python.org/issue31336 but we're still doing one lookup per possible slot name *and* per class along the MRO.

I propose to speed up this step by caching the known descriptors for each class.  This way, when instantiating a new class, you can simply iterate over the known descriptors of the MRO without wasting time on hundreds of dict lookups.

(and it is reasonably easy to find all slot descriptors in a dict: first select only __dunder__ names, then look them up in a dedicated mapping)
History
Date User Action Args
2017-12-16 12:21:18pitrousetrecipients: + pitrou, scoder, serhiy.storchaka
2017-12-16 12:21:18pitrousetmessageid: <1513426878.39.0.213398074469.issue32346@psf.upfronthosting.co.za>
2017-12-16 12:21:18pitroulinkissue32346 messages
2017-12-16 12:21:18pitroucreate