D vs. C#

Dave Dave_member at pathlink.com
Mon Oct 22 17:53:41 PDT 2007


"Robert Fraser" <fraserofthenight at gmail.com> wrote in message 
news:ffj0pl$iuq$1 at digitalmars.com...
> Dave Wrote:
>
>> > One possibility is to do profiling while the application is running and 
>> > do
>> > further optimizations based on that. The questions are, is the VM
>> > performance hit worse than the optimizations, and is there a compelling
>> > reason not to do those optimizations always?
>>
>> That's what Sun Hotspot does, but I've rarely seen where the results are
>> better than what a static compiler w/ the "-O2" switch can do and often 
>> seen
>> where they are worse. IIRC (for example) the Jet "Ahead of Time" Java
>> compiler can often outperform the Sun VM.
>>
>> Not that all this really matters for *most* code however, where just
>> compiling to native code is a big enough win. But I have seen the old 
>> 80-20
>> rule at work -- cases where 80% of the time is spent on 20% of the code
>> trying to make it run faster -- so it's not a moot point either.
>
> Right now in-flight optimization rarely makes code that runs faster, but 
> it's a new technology. In 10 years, I'm guessing that most code will run 
> equally fast under a VM as native, and another 10 and the VM will be 
> superior. Especially as multi-core architectures become more popular, I 
> think this will be a big issue (since the VM can automatically parallelize 
> loops, etc.).

I've (literally) heard that same thing for the last 10 years. Sun's Hotspot 
has been in constant development for about that long too, not to mention 
probably several times the amount of research $ on VM's rather than static 
compilers. Same w/ .NET which started out life as Visual J++.

For static multi-core/multi-thread optimization there is OpenMP and also the 
Intel and AMD MT and math libs. Sun has had Java and multi-CPU machines in 
mind since day one, back when they were one of the few large vendors of 
those types of systems. Vendors like Sun are probably a decade ahead of 
commodity Intel machines when it comes to hardware and operating system 
architecture, and they're the ones developing the high-end VM's. I think 
it's probably at the point now where just about any improvement made to VM's 
could be matched by the same improvement in static compilers and/or static 
libraries.




More information about the Digitalmars-d mailing list