Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue32379

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:MRO computation could be faster
Type:performanceStage:resolved
Components:Interpreter CoreVersions:Python 3.7
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: methane, pitrou, serhiy.storchaka, vstinner
Priority:normalKeywords:patch

Created on2017-12-19 19:54 bypitrou, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Pull Requests
URLStatusLinkedEdit
PR 4932mergedpitrou,2017-12-19 19:56
Messages (5)
msg308674 -(view)Author: Antoine Pitrou (pitrou)*(Python committer)Date: 2017-12-19 19:54
MRO computation involves a complicated merge calculation over several lists.  But, for the simple (common) case where a class has a single base, the computation could be much simpler: take the base's MRO and prepend the derived class.
msg308675 -(view)Author: Antoine Pitrou (pitrou)*(Python committer)Date: 2017-12-19 20:00
Benchmarks:* before:$ ./env-orig/bin/pyperf timeit "class Test: pass".....................Mean +- std dev: 9.51 us +- 0.17 us* after:$ ./env/bin/pyperf timeit "class Test: pass".....................Mean +- std dev: 8.89 us +- 0.09 us
msg308733 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-12-20 14:06
LGTM in general. But mro() returns a list."class Test: pass" is a trivial case. What are results if the class has a parent?
msg308734 -(view)Author: Antoine Pitrou (pitrou)*(Python committer)Date: 2017-12-20 14:15
Benchmarks with a parent:* Before:$ ./env-orig/bin/pyperf timeit -s "from unittest import TestCase" "class Test(TestCase): pass".....................Mean +- std dev: 10.4 us +- 0.1 us* After:$ ./env/bin/pyperf timeit -s "from unittest import TestCase" "class Test(TestCase): pass".....................Mean +- std dev: 9.89 us +- 0.12 us
msg308737 -(view)Author: Antoine Pitrou (pitrou)*(Python committer)Date: 2017-12-20 14:58
New changeset1f1a34c3145781628e10534440017b3b43211a60 by Antoine Pitrou in branch 'master':bpo-32379: Faster MRO computation for single inheritance (#4932)https://github.com/python/cpython/commit/1f1a34c3145781628e10534440017b3b43211a60
History
DateUserActionArgs
2022-04-11 14:58:55adminsetgithub: 76560
2017-12-20 14:58:51pitrousetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-12-20 14:58:23pitrousetmessages: +msg308737
2017-12-20 14:15:19pitrousetmessages: +msg308734
2017-12-20 14:06:11serhiy.storchakasetmessages: +msg308733
2017-12-19 20:00:20pitrousetmessages: +msg308675
2017-12-19 19:56:53pitrousetnosy: +vstinner,methane,serhiy.storchaka
2017-12-19 19:56:32pitrousetkeywords: +patch
stage: patch review
pull_requests: +pull_request4825
2017-12-19 19:54:59pitroucreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp