Faster Virtual Method Dispatch

Sean Kelly sean at f4.ca
Tue Apr 25 08:52:55 PDT 2006


Craig Black wrote:
> 
> Well, I think you can do this with C# since it supports stack objects. Even 
> still, C# is typically slower than Java (not by much though).  I confess 
> that I don't know all the technical details with VM's, but I have run my own 
> benchmarks.  VM-based code is just way slower than native code.  Can't 
> really tell you exactly why though because I don't really know or care to 
> know what goes on inside a VM. (Except for the purpose of explaining to 
> people why it is so much slower.)

One reason is that Java compilers perform basically no compile-time 
optimization, and the JIT does very little as well.  C/C++, on the other 
hand, can see huge performance improvements with optimization turned on. 
  C# does a bit better in this regard, but not tremendously so. 
However, some VM languages (such as the Lisp variants) seem to perform 
quite well compared to natively compiled code, though I don't have the 
experience to say why.


Sean



More information about the Digitalmars-d mailing list