[docs] [issue33032] Mention implicit cache in struct.Struct docs

Nick Coghlan report at bugs.python.org
Thu Mar 8 18:22:58 EST 2018


New submission from Nick Coghlan <ncoghlan at gmail.com>:

The struct.Struct docs claim that creating and re-using a Struct object will be noticeably faster than calling the module level methods repeatedly with the same format string, as it will avoid parsing the format string multiple times: https://docs.python.org/3/library/struct.html#struct.Struct

This claim is questionable, as struct has used an internal Struct cache since at least 2.5, so if you're using less than 100 different struct layouts in any given process, the only thing you'll be saving is a string-keyed dictionary lookup.

----------
assignee: docs at python
components: Documentation
messages: 313468
nosy: docs at python, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Mention implicit cache in struct.Struct docs
type: enhancement
versions: Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33032>
_______________________________________


More information about the docs mailing list