[issue19187] Use a set for interned strings

2013-10-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: Based on the discussion so far, I'm going to close this one. I don't think it is an appropriate use of sets (they are about membership testing, not about looking up values). The upside is minimal. The downside is hacking up the set implementation and ma

[issue19187] Use a set for interned strings

2013-10-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I afraid that adding new parameter to the set_contains_key function will slow down other set operations. It will be better return a key as the result of the function (NULL if not found). -- ___ Python tracker

[issue19187] Use a set for interned strings

2013-10-09 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > In embedded systems, every byte of memory counts It is not just embedded systems. The range 192 KB to 1.5 MB is where typical L2 cache sizes are these days. I would expect that the intern dictionary is accessed very often and much more often than th

[issue19187] Use a set for interned strings

2013-10-09 Thread STINNER Victor
STINNER Victor added the comment: Raymond> FWIW, I'm dubious that there will be any benefit from this at all. The savings of one-pointer is the dictionary is likely to be insignificant compared to the size of the string object themselves. As I wrote in python-dev, the dictionary is usually th

[issue19187] Use a set for interned strings

2013-10-09 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +loewis ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue19187] Use a set for interned strings

2013-10-09 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: The first reference above should have been to #1507011. -- ___ Python tracker ___ ___ Python-b

[issue19187] Use a set for interned strings

2013-10-09 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: This exact issue was discussed in #19187 and #7224 many years ago. -- nosy: +belopolsky ___ Python tracker ___ ___

[issue19187] Use a set for interned strings

2013-10-08 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +r.david.murray ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue19187] Use a set for interned strings

2013-10-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: I agree the benefit is likely to be small and very minor. Victor has experience measuring memory consumption of various programs, I would like to know about his measurements. -- ___ Python tracker

[issue19187] Use a set for interned strings

2013-10-08 Thread Raymond Hettinger
Changes by Raymond Hettinger : Added file: http://bugs.python.org/file31997/set_intern2.diff ___ Python tracker ___ ___ Python-bugs-list maili

[issue19187] Use a set for interned strings

2013-10-08 Thread Raymond Hettinger
Changes by Raymond Hettinger : Removed file: http://bugs.python.org/file31996/set_intern1.diff ___ Python tracker ___ ___ Python-bugs-list mai

[issue19187] Use a set for interned strings

2013-10-08 Thread Raymond Hettinger
Changes by Raymond Hettinger : Added file: http://bugs.python.org/file31996/set_intern1.diff ___ Python tracker ___ ___ Python-bugs-list maili

[issue19187] Use a set for interned strings

2013-10-07 Thread Raymond Hettinger
Raymond Hettinger added the comment: If sets need to be hacked-up to accommodate this, I would like to draft the patch for it that I think will be cleaner. FWIW, I'm dubious that there will be any benefit from this at all. The savings of one-pointer is the dictionary is likely to be insignifi

[issue19187] Use a set for interned strings

2013-10-07 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> rhettinger nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue19187] Use a set for interned strings

2013-10-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: Note that the resizing heuristic is slightly different for sets and dicts, so a small-to-middle-size dict can sometimesbe smaller than a set of the same len(). However, for large dicts (>= 5) it seems the corresponding set is most always 66% smaller.

[issue19187] Use a set for interned strings

2013-10-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Dict has a special case for string keys. Is set have such optimization? Yes (see set_lookkey_unicode). -- ___ Python tracker ___

[issue19187] Use a set for interned strings

2013-10-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Dict has a special case for string keys. Is set have such optimization? -- nosy: +serhiy.storchaka ___ Python tracker ___

[issue19187] Use a set for interned strings

2013-10-07 Thread Antoine Pitrou
New submission from Antoine Pitrou: This is a simple enhancement that may reduce memory consumption by a bit (unfortunately, this is difficult to measure using standard tools). -- components: Interpreter Core files: setintern.patch keywords: patch messages: 199154 nosy: haypo, pitrou pr