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.

classification
Title: let struct's internal cache use FIFO policy
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.9, Python 3.8
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: malin, methane, rhettinger
Priority: normal Keywords: patch

Created on 2019-03-30 02:43 by malin, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 12624 closed malin, 2019-03-30 02:46
Messages (3)
msg339168 - (view) Author: Ma Lin (malin) * Date: 2019-03-30 02:43
Currently, when the cache is full, the entire cache is cleared.
This patch let it use FIFO policy.

Inada Naoki, Raymond Hettinger, could you review this patch? Thanks.
No hurry, just do it when you have time.
msg339169 - (view) Author: Ma Lin (malin) * Date: 2019-03-30 03:11
FYI, re module's cache is using FIFO policy:

https://github.com/python/cpython/blob/v3.8.0a3/Lib/re.py#L288-L293
msg339181 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-03-30 06:58
I don't know that FIFO makessense in the context of how the struct module is typically used.  Also rebuilding structs in cheap so there is very little need for further optimization.  As far as I can tell, no user has ever reported a performance issue with struct (if they had, we could analyze their use case to determine an optimal cache strategy).

So, my preference is to leave the code as-is.
History
Date User Action Args
2022-04-11 14:59:13adminsetgithub: 80663
2019-03-30 06:58:22rhettingersetstatus: open -> closed
resolution: rejected
messages: + msg339181

stage: patch review -> resolved
2019-03-30 03:11:56malinsetmessages: + msg339169
2019-03-30 02:46:11malinsetkeywords: + patch
stage: patch review
pull_requests: + pull_request12558
2019-03-30 02:43:45malincreate