3 ms·
> it's my understanding that producing bytecode is as easy as--if not vastly easier than--producing code in another language Maybe true for unoptimized code.
by bodyfour 14y ago
> it's my understanding that producing bytecode is as easy as--if not vastly easier than--producing code in another language
Maybe true for unoptimized code. However, Java and C# compilers have received years of work to make efficient use of their respective VMs; standing on their shoulders makes some sense.
- MichaelGG 14y agoReally? What kind of optimizations does the C# compiler do when emitting IL? As far as I know, they are fairly straightfoward optimizations - there's nothing really that complex going on there. The C# team has said they aim for a straightfoward mapping to IL. You won't see the C# compiler inlining functions (even though the CLR does _way_ better with large functions and doesn't handle inlining well). It won't propagate constant expressions. You won't see it transforming recursive functions into loops. Does it even remove unused variables? All the optimizations that C# really relies on for performance are handled by the JIT, and any compiler following the same patterns will get the same enhancements, plus the ability to emit better IL than C#. That said, I'm still unconvinced it's easier to emit MSIL than C#, and I'm rather well versed with MSIL.
- mccoyst 14y agoMaybe things are different on Dalvik, but javac for the Oracle JVM is about as braindead as a java compiler can get; all of the optimizing is done during JIT.