[openstack-dev] [all][python3] use of six.iteritems()

Robert Collins robertc at robertcollins.net
Wed Jun 10 09:33:44 UTC 2015

On 10 June 2015 at 17:22, gordon chung <gord at live.ca> wrote:
> maybe the suggestion should be "don't blindly apply six.iteritems or items" rather than don't apply iteritems at all. admittedly, it's a massive eyesore, but it's a very real use case that some projects deal with large data results and to enforce the latter policy can have negative effects[1].  one "million item dictionary" might be negligible but in a multi-user, multi-* environment that can have a significant impact on the amount memory required to store everything.

> [1] disclaimer: i have no real world results but i assume memory management was the reason for the switch in logic from py2 to py3

I wouldn't make that assumption.

And no, memory isn't an issue. If you have a million item dict,
ignoring the internal overheads, the dict needs 1 million object
pointers. The size of a list with those pointers in it is 1M (pointer
size in bytes). E.g. 4M or 8M. Nothing to worry about given the
footprint of such a program :)


Robert Collins <rbtcollins at hp.com>
Distinguished Technologist
HP Converged Cloud

More information about the OpenStack-dev mailing list