3 ms·
64-bit made things worse, especially if using interpreted languages which often have convenient but complexly indirect structures. E.g. creating this:
by Erwin 17y ago
64-bit made things worse, especially if using interpreted languages which often have convenient but complexly indirect structures.
E.g. creating this:
d = dict((x,x * 42) for x in xrange(100000))
a dictionary with 100k items in Python, takes up 10996 kB RSS memory on my 64-bit system, but 5200 kB RSS on a 32-bit Python (same Python version). You've got your dictionary hash buckets, the integer objects etc, all separately allocated objects. The integers themselves are also 64-bit.
Of course, if I really cared about the memory in the above case I'd create an array or even a list that fit the key/value pattern; the array array.array('i', (x*42 for x in xrange(100000))) stores the same information in the maximally compact form increasing RSS by about 500k.
But given a production system with 32G of memory memory optimisation is rarely being made.
- tezza 17y agoYou could still used the 32bit python on the 64bit system if you were very concerned.
- silentbicycle 17y agoI ran some informal benchmarks in Lua to see how switching from 32 to 64 bit affected memory usage, and it seemed to take very roughly 1.3-1.4 times as much. There's other noise in the totals besides just doubling pointer size, though - padding in C structs due to pointer alignment, for example.