JAVA C# C/C++ comparison

JAVA C# C/C++ comparison

0 1765
HashFlare

JAVA is ‘semi-interpreted’ language, because compile to Bytecode first, and then at runtime interprete Bytecode to Nativecode through interpreter, but later java made some change, for the ‘Hot Spot Code'(frequently used methods or blocks), JVM will use JIT Compiler to compile Bytecode to Nativecode.

C# compiler compile code to Bytecode(so called Intermediate Language or IL, here we should actually talk about .NET, C# is one of the CLI languages), then CLR(Common Language Runtime) will translate IL to CPU command, CLR is not interpreter, before execution it will compile IL to Nativecode( this is called JIT Compile), JIT costs time, but for every part o f the code, generally it means each process will only be affected once on performance, after JIT compiled, CLR will remember it, next time will only execute compiled version.

compilation-process-managed-environment

 

C/C++

GCC_CompilationProcess

 

One common characteristic of the managed environments is that the compiler does not produce binary code, but rather intermediate meta-code, called MSIL – Microsoft Intermediate Language in .Net and Bytecode in Java.

so,JAVA & C# are both JITed languages, so the performance wholly depends on the JIT compiler and the runtime implementation the run in.

 

 

some comments:

Pros and Cons of the Just In Time compiler

The JIT compilation comes with a number of benefits, the biggest one in my opinion is the performance benefits you get. The just in time compilation allows the CLR (Common Language Runtime, playing the role of the Assembler component) to execute only the code that is necessary. For example, if you have a really big WPF application, it will not be loaded all at once. Instead, the CLR will start executing different portions of your code translating them to native instructions in a very efficient way, because it is able to inspect the system “just in time” and produce an optimized code, rather than following a certain predefined pattern. Unfortunately, one drawback is that startup process is slower, meaning that it’s not good for use of packages that require a lot of time to load.

 

refer:

The Process of Compilation in C++, Java and .Net

C# versus C++ versus Java performance comparison

JAVA程序编译和运行的过程

Java编译与JIT编译

CLR vs JIT  CLR中的JIT编译器

Comparison of C Sharp and Java

Comparison of the Java and .NET platforms

Comparison of Java and C++

Java performance

C++ performance vs. Java/C#

Strongly Recommend language basic learning site :http://www.dotnetperls.com/

 

友荐云推荐

SIMILAR ARTICLES

0 1771