Michael Bacarella wrote: > You can download the list of keys from here, it's 43M gzipped: > http://www.sendspace.com/file/9530i7 > > 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 > > 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. -- http://mail.python.org/mailman/listinfo/python-list
- Re: Populating a dictionary, fast Hrvoje Niksic
- Re: Populating a dictionary, fast Michael Bacarella
- Re: Populating a dictionary, fast DouhetSukd
- Re: Populating a dictionary, fast DouhetSukd
- Re: Populating a dictionary, fast Ben Finney
- Re: Populating a dictionary, fast Michael Bacarella
- Re: Populating a dictionary, fast Istvan Albert
- Re: Populating a dictionary, fast Michael Bacarella
- Re: Populating a dictionary, fast Istvan Albert
- Re: Populating a dictionary, fast Michael Bacarella
- Re: Populating a dictionary, fast Arkanes
- RE: Populating a dictionary, fast [SOLVED SOLVE... Michael Bacarella
- Re: Populating a dictionary, fast [SOLVED SOLVE... Aaron Watters
- Re: Populating a dictionary, fast [SOLVED S... Hrvoje Niksic
- Re: Populating a dictionary, fast [SOLV... Steven D'Aprano
- Re: Populating a dictionary, fast ... Aaron Watters
- Re: Populating a dictionary, fast ... Aaron Watters
- Re: Populating a dictionary, fast ... Chris Mellon
- Re: Populating a dictionary, fast ... Istvan Albert
- Re: Populating a dictionary, f... Aaron Watters
- RE: Populating a dictionary, f... Michael Bacarella