I think that for every method with the same name an hash table indexed on the types of the argument is created, and when the method is called, a lookup is made on the table.
> Hmm. I've been trying to grok through dynamic dispatching speedup techniques - the Sun Self papers are pretty good, Sun's index doesn't have the papers themselves but you can ask Google for them.
I've found those papers in the past (a few weeks ago), but I've never found the will to read them, they are written for people already in the compilers' world and I'm still learning the basics about compilers.
BTW, a good type inferencer + a good function inliner could solve the problem, but I wouldn't know even where to start to implement them :(.
Use a "Polymorphic Inline Cache" (PIC). Basically if a piece of code could call several different methods, we figure out which one it is, then we create a copy of the calling function which does the type checking at the top and specialize all method calls to that type: