Message308474
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) |
|
Date |
User |
Action |
Args |
2017-12-16 12:21:18 | pitrou | set | recipients:
+ pitrou, scoder, serhiy.storchaka |
2017-12-16 12:21:18 | pitrou | set | messageid: <1513426878.39.0.213398074469.issue32346@psf.upfronthosting.co.za> |
2017-12-16 12:21:18 | pitrou | link | issue32346 messages |
2017-12-16 12:21:18 | pitrou | create | |
|