Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hash-tables
#2
errr...I would *think* the second would be faster since you're doing 1 lookup instead of 3. In a properly implemented hash table with a good hash function, lookup is O(1) with the size of the table.

If you're not sure, measure. Measure before optimizing to see if you even need to optimize, and measure after to make sure it actually makes it faster.

Donald Knuth Wrote:Premature optimization is the root of all evil.
Reply


Messages In This Thread
Hash-tables - by Nikkey - 2009-02-18, 10:34 PM
Hash-tables - by Spaz - 2009-02-19, 02:54 PM
Hash-tables - by Nikkey - 2009-02-19, 11:09 PM
Hash-tables - by Fiel - 2009-02-23, 01:35 PM
Hash-tables - by Stereo - 2009-02-23, 06:02 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)