Issue 32385: Clean up the C3 MRO algorithm implementation. (original) (raw)
Issue32385
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.
This issue has been migrated to GitHub: https://github.com/python/cpython/issues/76566
classification
Title: | Clean up the C3 MRO algorithm implementation. | ||
---|---|---|---|
Type: | performance | Stage: | resolved |
Components: | Interpreter Core | Versions: | Python 3.7 |
process
Status: | closed | Resolution: | fixed |
---|---|---|---|
Dependencies: | Superseder: | ||
Assigned To: | Nosy List: | pitrou, serhiy.storchaka | |
Priority: | normal | Keywords: | patch |
Created on 2017-12-20 15:40 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.
Pull Requests | |||
---|---|---|---|
URL | Status | Linked | Edit |
PR 4942 | merged | serhiy.storchaka,2017-12-20 15:42 |
Messages (3) | ||
---|---|---|
msg308739 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2017-12-20 15:40 |
The C3 MRO algorithm implementation uses lists and converts input tuples to lists. This is redundant, because these lists are not mutated. The proposed PR makes the implementation using tuples and gets rid of unneeded conversions. | ||
msg308751 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2017-12-20 17:18 |
This has also a performance effect. $ ./python -m perf timeit -s "class A: pass" -s "class B: pass" --duplicate 1000 "class C(A, B): pass" Before: Mean +- std dev: 9.41 us +- 0.28 us After: Mean +- std dev: 8.94 us +- 0.28 us | ||
msg308752 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2017-12-20 17:21 |
New changeset 6b91a5972107ec8dd5334f4f2005626baa2b8847 by Serhiy Storchaka in branch 'master': bpo-32385: Clean up the C3 MRO algorithm implementation. (#4942) https://github.com/python/cpython/commit/6b91a5972107ec8dd5334f4f2005626baa2b8847 |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:58:55 | admin | set | github: 76566 |
2017-12-20 17:26:59 | serhiy.storchaka | set | status: open -> closedresolution: fixedstage: patch review -> resolved |
2017-12-20 17:21:04 | serhiy.storchaka | set | messages: + |
2017-12-20 17🔞17 | serhiy.storchaka | set | messages: + |
2017-12-20 15:42:35 | serhiy.storchaka | set | keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest4834> |
2017-12-20 15:40:56 | serhiy.storchaka | create |