4 ms·
You don't know until you try. Computed goto is great by itself, but it can disable some optimizations. Large functions can also disable some optimizations, so s
by souprock 6y ago
You don't know until you try. Computed goto is great by itself, but it can disable some optimizations. Large functions can also disable some optimizations, so splitting opcodes out into separate functions can sometimes be good. Sometimes an array of function pointers will beat a switch or computed goto. Something like switch(opcode & 0xff000000) is far worse than something like switch(opcode >> 24) because gcc will think that it is sparse (and generate a tree of branches instead of a jump table) even if all possible cases are present. Marking the default with __builtin_unreachable() can help.