I wondered if it were possible to accelerate in hardware the Python dict? Dicts are mappings between a key and value that form a large part of the backbone of how Python works. Everything is an object; objects are built with dicts.

I have heard of CAMs (content addressable memories), but apart from a similarity in the name, I don't know if they could help in any thought experiment to create a computer optimised to run Python. (An equivalent to Forth, Java and Lisp optimised machines).

Any ideas and references appreciated.

  • \$\begingroup\$ I don't know that it's worth the cost and complexity of trying to optimize every aspect of it. Handling just the hash function and equality comparison would probably give decent gains alone. \$\endgroup\$ Mar 21, 2014 at 9:14
  • \$\begingroup\$ Interesting idea, perhaps do a profiling test showing what portion of time is spent on dict lookup...? \$\endgroup\$
    – Dzarda
    Mar 21, 2014 at 9:25

1 Answer 1


The answer is a guarded "Yes" : it is possible, but probably not commercially worthwhile. Hardware acceleration for OO languages was once a hot topic, but died down about 25 years ago.

One project was the Linn Rekursiv. It coincided with the rapid rise of RISC hardware and didn't last long enough to see their fall back from the leading edge. Probably the best published article about it was Dick Pountain's Byte article. Picture of the Rekursiv boardhere...

So while the Rekursiv project proved the feasibility of its ideas, its added complexity (about 70000 gates instead of 20000 for a RISC, and all those extra pins!) made it financially unattractive on the small ASICs of the time. Now, with gate budgets in the high millions, you could afford that extra logic and barely notice the cost, but the industry is so heavily entrenched in current practice that you would have to demonstrate some huge advantage - and even then, (like many better technologies available) it would be barely noticed, then (at best) politely ignored. (Disclosure of interest : if this account appears bitter and twisted; I was one of the Rekursiv team)

Now if you need dynamic binding in a C++ program you can watch your CPU stepping painfully through method table after method table looking for the right function to call, instead of a hardware accelerated method hash despatching in 6 cycles (with the commonest "primitives" not just despatched but completed faster than that).

An FPGA on a board with a PCIe interface can be used as a coprocessor to a regular CPU, and you can offload computationally heavy stuff to the FPGA. However the PCIe interface is quite slow, so the cost of the offloaded operation has to be quite high before this is worthwhile.

Some FPGAs incorporate a CPU close to the FPGA fabric and these may serve as a way to prototype your ideas with less overhead than the PCIe bus (but with a lower performance CPU) : I wish this had been around in the Rekursiv days!

  • \$\begingroup\$ Hmmm - I was spercifically interested in the dynamic programming language Python, You mention Rekursiv in conjunction with C++ and dynamic binding. I wonder if Rekursiv-like techniques would help with Python? \$\endgroup\$
    – Paddy3118
    Mar 21, 2014 at 16:14
  • \$\begingroup\$ Rekursiv was aimed to support dynamic languages (not C++) - pure OO languages like Smalltalk and its own Lingo. (Python wasn't around at the time, but looks like a good match). There may be techniques in the Rekursiv that would serve as a starting point for a Python engine; and some that have not stood the test of time! \$\endgroup\$
    – user16324
    Mar 21, 2014 at 16:37
  • \$\begingroup\$ @BrianDrummond have you had a look at Altium's FPGA tools? The tools are fatally flawed imo, but Altium did implement a few interesting ideas before they gave up. In this case I'm thinking of their Application Specific Processor component that, when included in a soft CPU design, can be used to offload computationally intensive C functions to FPGA fabric. \$\endgroup\$
    – markt
    Mar 22, 2014 at 2:18
  • \$\begingroup\$ Either Aldec or Altium or both I've tried several times, and never managed to get them to install - even using Wine. \$\endgroup\$
    – user16324
    Mar 22, 2014 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.