<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Also, modern compiler technology tends to use "infinite register" machines for the intermediate representation, then uses register coloring to assign the actual registers (and generate spill code if needed). I've seen work on inter-function optimization for avoiding some register loads and stores (combined with tail-call optimization, it can turn recursive calls into loops in the register machine).</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 2 February 2016 at 09:16, Sven R. Kunze <span dir="ltr"><<a href="mailto:srkunze@mail.de" target="_blank">srkunze@mail.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 02.02.2016 00:27, Greg Ewing wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Sven R. Kunze wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Are there some resources on why register machines are considered faster than stack machines?<br>
</blockquote>
<br>
If a register VM is faster, it's probably because each register<br>
instruction does the work of about 2-3 stack instructions,<br>
meaning less trips around the eval loop, so less unpredictable<br>
branches and less pipeline flushes.<br>
</blockquote>
<br></span>
That's was I found so far as well.<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This assumes that bytecode dispatching is a substantial fraction<br>
of the time taken to execute each instruction. For something<br>
like cpython, where the operations carried out by the bytecodes<br>
involve a substantial amount of work, this may not be true.<br>
</blockquote>
<br></span>
Interesting point indeed. It makes sense that register machines only saves us the bytecode dispatching.<br>
<br>
How much that is compared to the work each instruction requires, I cannot say. Maybe, Yury has a better understanding here.<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
It also assumes the VM is executing the bytecodes directly. If<br>
there is a JIT involved, it all gets translated into something<br>
else anyway, and then it's more a matter of whether you find<br>
it easier to design the JIT to deal with stack or register code.<br>
</blockquote>
<br></span>
It seems like Yury thinks so. He didn't tell use so far.<br>
<br>
<br>
Best,<br>
Sven<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/pludemann%40google.com" rel="noreferrer" target="_blank">https://mail.python.org/mailman/options/python-dev/pludemann%40google.com</a><br>
</div></div></blockquote></div><br></div>