Most efficient way to build very large dictionaries

Roger Binns rogerb at rogerbinns.com
Wed Dec 24 03:27:25 EST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

python at bdurham.com 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.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAklR8mkACgkQmOOfHg372QQvLQCgu6NYNUuhgR06KQunPmIrZ64B
+rsAnAgQOKzMdmonF+zIhsX2r/Xg/72Y
=LFfW
-----END PGP SIGNATURE-----




More information about the Python-list mailing list