First of all, let me make it clear that I'm currently writing a bytecode interpreter.
I've been reading everywhere about the bytecode having to be "compact". However, I don't really understand what this is supposed to mean, or what the advantages would be.
Currently, for example, my "bytecode" is an array of tuples, the first element being a byte - the opcode itself (8 bits) and the second one a uint64 (what one would call an unsigned long long
) - the optional parameter for the operation (64 bits).
Tha makes each "instruction" 72 bits. (Admittedly quite innecessary, since many of them don't take any argument, but I thought it was easier - and more performant? - this way since I don't have to check every time if there is a parameter, and just go through the list of instructions).
So, my questions:
Benefits I can think of: