Hacker News new | ask | show | jobs
by vilda 3174 days 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/ff8ad0a576c6cf375e682...
2 comments

It seems likely that Python is targeting a wider field than just the latest few generations of desktop/server CPUs.
I 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