Most efficient way to build very large dictionaries

Roger Binns rogerb at
Wed Dec 24 09:27:25 CET 2008

Hash: SHA1

python at wrote:
> Can I take advantage of this knowledge to optimize

You do the optimization last :-)  The first thing you need to do is make
sure you have a way of validating you got the correct results.  With 25M
entries it would be very easy for an optimization to get the wrong
results (maybe only one result wrong).  Once you can verify the results
correctness, write the simplest most readable code possible.

Then once your whole program is approaching completion time how long
things take to get an idea of where to optimize.  For example it is
pointless optimizing the loading phase if it only takes 2 minutes out of
a 3 hour runtime.  Finally you can optimize and always have a way of
verifying that the optimizations are correct.  You have the original
code to document what is supposed to be happening as optimized code
tends to get rather obfuscated and unreadable.

Version: GnuPG v1.4.9 (GNU/Linux)


More information about the Python-list mailing list