fastest table lookup

Michael J. Fromberger Michael.J.Fromberger at Clothing.Dartmouth.EDU
Mon Oct 25 15:00:54 EDT 2004


In article <mailman.5439.1098729682.5135.python-list at python.org>,
 "Neal D. Becker" <ndbecker2 at verizon.net> wrote:

> I need a fairly small lookup table, and I'm wondering which data python data
> structure would be fastest.  I could use a list, tuple, dictionary, numeric
> array, or maybe plain python array.  The table would be indexed by simple
> integers and would be dense (filled).

My recommendation is that you implement the table, and test your 
implementation on some representative cases.  My sense is that for a 
small, dense table indexed by integers, it would be difficult to beat 
array indexing.  But rather than taking my suppositions for it, why not 
try it out and see?

-M

-- 
Michael J. Fromberger             | Lecturer, Dept. of Computer Science
http://www.dartmouth.edu/~sting/  | Dartmouth College, Hanover, NH, USA



More information about the Python-list mailing list