A RetroSearch Logo

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

Search Query:

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

[Python-Dev] Dictionary sparseness

[Python-Dev] Dictionary sparsenessAgthorr agthorr@barsoom.org
Mon, 5 May 2003 13:14:16 -0700
On Mon, May 05, 2003 at 03:34:58PM -0400, Tim Peters wrote:
> Sure -- micro-optimizations are always fragile.  This kind of thing will be
> done by someone who's certain the dict is henceforth read-only, and who
> thinks it's worth the risk and obscurity to get some small speedup.  

An alternate optimization would be the additional of an immutable
dictionary type to the language, initialized from a mutable dictionary
type.  Upon creation, this dictionary would optimize itself, in a
manner similar to "gperf" program which creates (nearly) minimal
zero-collision hash tables.

On this plus side, this would form a nice symmetry with the existing
mutable vs immutable types.

Also, it would be proof against bit-rot, since either:
 a) the user changes the mutable dictionary before it is optimized.
    In this case, the optimizer will simply optimize the new
    dictionary, or
 b) the user attempts to modify the immutable dictionary, which will
    fail with an error.

-- Agthorr



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