Populating a dictionary, fast
Michael Bacarella
mbac at gpshopper.com
Mon Nov 12 12:39:00 EST 2007
> > and see it take about 45 minutes with this:
> >
> > $ cat cache-keys.py
> > #!/usr/bin/python
> > v = {}
> > for line in open('keys.txt'):
> > v[long(line.strip())] = True
>
> On my system (windows vista) your code (using your data) runs in:
>
> 36 seconds with python 2.4
> 25 seconds with python 2.5
> 39 seconds with python 3000
*wow*
The win32 Python or the cygwin Python?
What CPU architecture?
More information about the Python-list
mailing list