Issue 35585: Speedup Enum lookup (original) (raw)

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/79766

classification

Title: Speedup Enum lookup
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.8, Python 3.7

process

Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ethan.furman Nosy List: asvetlov, ethan.furman
Priority: normal Keywords: patch, patch

Created on 2018-12-26 00:26 by asvetlov, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 11318 merged asvetlov,2018-12-26 00:29
PR 11318 merged asvetlov,2018-12-26 00:29
PR 11324 merged miss-islington,2018-12-26 18:46
Messages (3)
msg332524 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2018-12-26 00:26
Construction enums by-value (e.g. http.HTTPStatus(200)) performs two dict lookups: if value in cls._value2member_map_: return cls._value2member_map_[value] Changing the code to just return cls._value2member_map_[value] with catching KeyError can speedup the fast path a little.
msg332558 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2018-12-26 18:45
New changeset 34ae04f74dcf4ac97d07c3e82eaf8f619d80cedb by Ethan Furman (Andrew Svetlov) in branch 'master': Speed-up building enums by value, e.g. http.HTTPStatus(200) (#11318) https://github.com/python/cpython/commit/34ae04f74dcf4ac97d07c3e82eaf8f619d80cedb
msg332562 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2018-12-26 20:48
New changeset 705b5998035739b1794a862123d3dc6e339a14d0 by Andrew Svetlov (Miss Islington (bot)) in branch '3.7': Speed-up building enums by value, e.g. http.HTTPStatus(200) (GH-11318) (GH-11324) https://github.com/python/cpython/commit/705b5998035739b1794a862123d3dc6e339a14d0
History
Date User Action Args
2022-04-11 14:59:09 admin set github: 79766
2018-12-26 20:52:32 asvetlov set keywords:patch, patchstatus: open -> closedresolution: fixedstage: patch review -> resolved
2018-12-26 20:48:58 asvetlov set messages: +
2018-12-26 18:46:02 miss-islington set pull_requests: + <pull%5Frequest10587>
2018-12-26 18:45:38 ethan.furman set messages: +
2018-12-26 01:23:47 rhettinger set keywords:patch, patchassignee: ethan.furmannosy: + ethan.furman
2018-12-26 00:29:57 asvetlov set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest10569>
2018-12-26 00:29:55 asvetlov set keywords: + patchstage: (no value)pull_requests: + <pull%5Frequest10568>
2018-12-26 00:26:24 asvetlov create