A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-May/035635.html below:

[Python-Dev] Simple dicts

[Python-Dev] Simple dictsGreg Ward gward@python.net
Thu, 15 May 2003 09:39:27 -0400
On 14 May 2003, Brett C. said:
> When I took data structures I was taught that chaining was actually the 
> easiest way to do hash tables and they still had good performance 
> compared to open addressing.  Because of this taught bias I always 
> wondered why Python used open addressing; can someone tell me?

If your nodes are small, chaining has a huge overhead -- an extra
pointer for each node in a chain.  You can play around with glomming
several nodes together to amortize the cost of those pointers, but ISTR
the win isn't that big.

Open addressing is more memory-efficient, but when the hash table fills
(or gets close to full), you absolutely positively have to rehash.

(Back in January, I played around with writing a custom hash table for
keeping ZODB indexes in memory without using a Python dict, so that's
why I'm fairly fresh on hash table minutiae.)

        Greg
-- 
Greg Ward <gward@python.net>                         http://www.gerg.ca/
NOBODY expects the Spanish Inquisition!



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4