6 ms·
This myth is even in Python source code[1] However, since the indirect jump instruction is shared by all opcodes, the CPU will have a hard time making th
by vilda 9y ago
This myth is even in Python source code[1]
However, since the indirect jump instruction is shared
by all opcodes, the CPU will have a hard time making
the right prediction for where to jump next (actually,
it will be always wrong except in the uncommon case of
a sequence of several identical opcodes).
[1] https://github.com/python/cpython/blob/ff8ad0a576c6cf375e68276e614e551b3b759254/Python/ceval.c#L825 https://github.com/python/cpython/blob/ff8ad0a576c6cf375e682...
- caf 9y agoIt seems likely that Python is targeting a wider field than just the latest few generations of desktop/server CPUs.
- ufo 9y agoI think that this might just be because that code is a bit older now. I actually have to thank the documentation there for explaining all the flags you need to turn on GCC to get the computed goto to work. By default gcc's optimizer will mess things up and I would have never figured out the flags by myself to be able to run my benchmarks