Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What makes the Java compiler so fast?

I was wondering about what makes the primary Java compiler (javac by sun) so fast at compilation?

..as well as the C# .NET compiler from Microsoft.

I am comparing them with C++ compilers (such as G++), so maybe my question should have been, what makes C++ compilers so slow :)

like image 801
Lawand Avatar asked Dec 31 '08 13:12

Lawand


People also ask

Why is Java so fast?

Python and Java are two of the most popular and robust programming languages. Java is generally faster and more efficient than Python because it is a compiled language. As an interpreted language, Python has simpler, more concise syntax than Java.

Does Java compile fast?

In fact, when compared against its peers, Java is pretty fast. Java is able to compete with -- and sometimes outperform -- other interpreted languages based on how it manages memory, completes just-in-time (JIT) compiles and takes advantage of various features of its underlying architecture.

What makes Go compile quickly?

Go is Fast Because Go is compiled to machine code, it will naturally outperform languages that are interpreted or have virtual runtimes. Go programs also compile extremely fast, and the resulting binary is very small. Our API compiles in seconds and produces an executable file that is 11.5 MB.

Why does Java compile faster than C++?

Java, by virtue of its ability to compile the program as it executes, can achieve performance greater than that of C++ because the compiler has access to information that just isn't available to a traditional C++ compiler. There is a lot of work between here and there, but it can be done.


1 Answers

That question was nicely answered in this one: Why does C++ compilation take so long? (as jalf pointed out in the comments section)

Basically it's the missing modules concept of C++, and the aggressive optimization done by the compiler.

like image 70
Johannes Schaub - litb Avatar answered Oct 13 '22 01:10

Johannes Schaub - litb