again me ;-)
I read a discussion on the D forum about using jump tables. I think the nimrod case statement over an enum could be a nice possibility to use these jump tables in the c codegen as well. When all possible values of an enum are handled in the case (no else allowed), then this case could be translated into a jump table instead of a switch. This should give a better performance because of a better use of the branch prediction. Maybe something for version 0.9++ ?
# bytecode interpreter loop
while true:
{.computedGoto.}
case code[pc]
of jump: pc = jumpTarget
of addi: ...
...
I tested it already - in my test case I got a performance increase of about 30%. There seems to be a problem if instructions are before (problem here) or after the case (no problem here). I will post a bug report when I am sure.
Wish I had more time to program in nimrod - but I do my best to convince everybody I talk to.