Populating a dictionary, fast

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Mon Nov 12 12:57:42 CET 2007

On Sun, 11 Nov 2007 11:42:08 -0700, Arkanes wrote:

> It takes about 20 seconds for me. It's possible it's related to int/long
> unification - try using Python 2.5. If you can't switch to 2.5, try
> using string keys instead of longs.

I'm getting similar behaviour to the Original Poster, and I'm using 
Python 2.5 under Linux.

Unlike him, my PC only has 1GB of RAM, and I've got a LOT of other apps 
running, so I'm not surprised it's taking about two minutes to build the 
dict. I put that down to low memory, and given the limitations of my 
system, I'm not worried about that.

But taking 30+ minutes to delete the dict, even with garbage collection 
off, that can't be good.


More information about the Python-list mailing list