At 12:00 PM 6/13/2001 +0100, Dave Mitchell wrote:
>I was thinking back to the earlier discusions on opcode dispatch,
>and the fact that some people thought that a big switch was as good as,
>or possibly faster than a dispatch table. Which led me to think...

The only reason big switch statements are sometimes faster than a dispatch 
table is because there tends to be more code around for the optimizer to 
work with. Switches themselves really aren't all that much faster in and of 
themselves.

>should we abandon vtables (ie arrays of fn pointers indexed by op),
>and just have a single hander function per type which has the op as an arg?

Are you talking vtables (which we're using for functions attached to data) 
or the indirect opcode function table? If the former, we don't want to 
abandon the idea for anything other than a crippling speed hit, since it 
gives us a lot of flexibility cheaply. Abandoning a function table for the 
ops for a switch means that extension opcodes are going to be slower than 
normal ones--we'll essentially have to maintain both the switch and the 
dispatch table.

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to