[Python-Dev] When do sets shrink? (original) (raw)

Fernando Perez fperez.net at gmail.com
Sun Jan 1 21:06:03 CET 2006


Raymond Hettinger wrote:

It might be better to give more generic advice that tends to be true across implementations and versions: "Dense collections like lists tuples iterate faster than sparse structures like dicts and sets. Whenever repeated iteration starts to dominate application run-time, consider converting to a dense representation for faster iteration and better memory/cache utilization." A statement like this remains true whether or not a down-sizing algorithm is present.

Thanks. While I certainly wasn't advocating an early optimization approach, I think that part of using a tool effectively is also knowing its dark corners. Sometimes you do need them, so it's handy to have the little 'break the glass in case of an emergency' box :)

Cheers,

f Hmm, your initial may be infringing on another developer's trademarked signature ;-)

Well, tough. It happens to be my name, and I've been signing like this since long before I started using python. I'll think about changing when the lawsuits come knocking, if I can't get the EFF to defend me ;-)

Thanks again for your feedback. Until a suitable wiki comes along, I've kept your message in my python-info folder as a potentially useful nugget.

Regards,

f



More information about the Python-Dev mailing list