New submission from Gregory P. Smith:

The implementation of string interning uses a dict [1].  It would consume less 
memory and be a bit simpler if it used a set.

Identifier strings in a program are interned.  If you have a large program with 
a lot of code, this makes for a large dictionary.

Experimenting with changing this to use a set on 2.7 found ~22k savings on an 
interactive interpreter startup.  Measuring it on a huge application showed a 
few hundred k saved.

[1]: https://hg.python.org/cpython/file/3.5/Objects/unicodeobject.c#l1579

----------
messages: 259885
nosy: gregory.p.smith, nnorwitz
priority: low
severity: normal
stage: needs patch
status: open
title: interned strings are stored in a dict, a set would use less memory
type: enhancement
versions: Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26314>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to