[Python-ideas] Associative arrays in hardware
ironfroggy at socialserve.com
Tue Apr 15 15:08:49 CEST 2008
Given how modern hardware is implemented, with a large set of their
instructions being translated into even lower-level instructions, I
don't know there would actually be a huge benefit. Just because there
is an instruction for something doesn't mean its absolutely blazing.
Most likely this instruction would take several cycles to execute,
just like the equivalent instructions currently implementing a dict-
lookup. This also can't handle the fact that most (useful) values in
a dictionary are not atomic (they are not a single int, float, etc.)
and require custom __hash__ functions. How do you propose a hardware
solution would solve those hurdles?
On Apr 15, 2008, at 1:24 AM, Neil Toronto wrote:
> Full-on associative memory wouldn't be necessary. If there were a
> machine-level instruction in current chips that did a dict-style
> almost as fast as a base+index*size, Python could *scream*. It might
> work like 80x86's lea (load effective address):
> hashaddr base, recsize, dictsize, value, destreg
> It would be very CISCy, and there are a whole host of practical
> dealing with hashing functions, good collision resolution, etc. But
> pointer/index-based (e.g. interned string) lookup could go almost as
> fast as C++'s "this->". Mainstream is moving toward dynamic languages,
> and it makes sense to support that in hardware.
> Heck, I hear routers and switches already have things like this. Does
> anybody have the ear of an Intel chip designer?
> Python-ideas mailing list
> Python-ideas at python.org
More information about the Python-ideas