How does the Java Runtime Environment compare with the .NET platform in terms of the compilation process?

I am learning how to convert source code to machine code through .NET and the JRE Framework. To start, I did some research comparing the two processes and created this diagram . I need help criticizing its correctness and, more importantly, adding some serious things that I have missed in order to better understand the compilation path.

enter image description here

+10
java compiler-construction c #
source share
1 answer

Both .NET and Java are compiled into bytecode, an intermediate language that contains instructions for the virtual machine. This is not machine code because it cannot work directly on a physical machine. Instead, it happens (at least today; in this regard, Java has a darker history) that, at run time, the compiler starts, which, just in time, translates the instructions of the virtual machine into its own code, which then runs directly. This provides a significant performance advantage over interpretation alone.

They are slightly different in this regard. The Oracle Java implementation (Hotspot) uses a reasonable combination of interpretation, measurement, and JIT, compiling only those parts that are heavily used, and interpreting differently. This should reduce the initial impact of the JIT compiler (which should start in advance, increasing the startup time of the process), while at the same time ensuring good performance. On the other hand, .NET always JIT compiles all used code (however, unused code does not compile).

Editing (2019): to date, .NET also has multi-level compilation, where depending on which code is executed often, this code will be further optimized.

Regarding the question that you mentioned in your comments: yes, the CLR and JVM are the platforms on which such programs work. A virtual machine is also a machine, just less hardware. Both of them are tightly integrated with the corresponding structure, the base class library for .NET and the Java class library for Java. This is the framework.

+12
source share

All Articles