On 02.02.2016 00:27, Greg Ewing wrote:
Sven R. Kunze wrote:
Are there some resources on why register machines are considered faster than stack machines?

If a register VM is faster, it's probably because each register
instruction does the work of about 2-3 stack instructions,
meaning less trips around the eval loop, so less unpredictable
branches and less pipeline flushes.

That's was I found so far as well.

This assumes that bytecode dispatching is a substantial fraction
of the time taken to execute each instruction. For something
like cpython, where the operations carried out by the bytecodes
involve a substantial amount of work, this may not be true.

Interesting point indeed. It makes sense that register machines only saves us the bytecode dispatching.

How much that is compared to the work each instruction requires, I cannot say. Maybe, Yury has a better understanding here.

It also assumes the VM is executing the bytecodes directly. If
there is a JIT involved, it all gets translated into something
else anyway, and then it's more a matter of whether you find
it easier to design the JIT to deal with stack or register code.

It seems like Yury thinks so. He didn't tell use so far.


Best,
Sven
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to