Re:Python consumes a lot of memory – how to reduce the size ...
by spott on Wednesday July 10, 2019 @01:17PM
(#20404070)
On the other hand, the first 256 integers are singletons in python, so they aren't duplicated.
Re:Python consumes a lot of memory – how to reduce the size ...
by mswtk on Wednesday July 10, 2019 @02:11PM
(#20404669)
Slightly pedantic correction: This is a performance optimization in CPython. I wouldn't be surprised if other implementations have something similar, but to my best knowledge, this behaviour isn't part of the standard.
Re:Python consumes a lot of memory – how to reduce the size ...
by merlincorey on Wednesday July 10, 2019 @05:37PM
(#20406841)
> ... but to my best knowledge, this behaviour isn't part of the standard.
To the best of my knowledge, Python isn't one such language with a standard, is it?
Re:Python consumes a lot of memory – how to reduce the size ...
by ben509 on Wednesday July 10, 2019 @11:03PM
(#20408783)
The standard is documented in PEPs[1]. CPython is the flagship implementation, and many PEPs discuss it directly, but if you're looking to write another Python, that's where you'd go.
Re:Python consumes a lot of memory – how to reduce the size ...
by hermitdev on Wednesday July 10, 2019 @01:34PM
(#20404276)
0-255 (inclusive) are singletons, just to clarify.
The Cython and Numpy cases directly store the actual data and this has the larger effect to reduce memory.