What is the best implementation, from a performance point of view, of branched function calls?
In the naive case we have a rather large switch statement that interprets bytecode and executes a function call depending on code.
In the normal case we have computed gotos and labels that do the same thing.
What is the absolute best way to do this?
An abstract example,
schedule: swap_entity(); goto *entity_start(); lb_code1: do_stuff(); goto *next_code_item(); lb_code2: do_stuff(); goto *next_code_item(); ...
Edit: My reference to "branched function calls" was perhaps somewhat erroneous. Branched code execution.
Best Solution
If you're looking for a speed boost here, you should look at other bytecode dispatch mechanisms. There was a question which sort-of asked that before.
Basically, you now have a goto which is probably incorrectly predicted every time, followed by a function call. With a technique like direct threading, you can probably reduce your interpreter overhead significantly. Inline threading is harder, but with greater benefit.
I gave some further resources in the other question.