5

Possible Duplicate:
Why does C++ compilation take so long?

I am working with two different projects of about the same size (loc). The Java build process using Ant is measured in minutes. The C++ build processing using the CMAKE tools is measured in hours.

What characteristics of Java allow it to build much faster than a comparable C++ program?

Community
  • 1
  • 1
Jon
  • 237
  • 3
  • 12

5 Answers5

4

I have to suspect that the absence of kilolines of header files is a lot to do with it.

chaos
  • 122,029
  • 33
  • 303
  • 309
4

Different Optimization Strategies

Java code is typically not optimized as much as C/C++ code at compile time. This means that Java byte code is "less optimized" than "similar" native code emitted by C/C++ compilers. The JVM's Just In Time (JIT) compiler does optimizations at runtime to increase byte code performance.

Greg Mattes
  • 33,090
  • 15
  • 73
  • 105
4

Templates are especially slow to compile.

Martin Cote
  • 28,864
  • 15
  • 75
  • 99
2

Just having the same LOC doesn't mean building will take the same time. For example, if you add big header files like windows.h in C++, it will have to build much more for this one line.

schnaader
  • 49,103
  • 10
  • 104
  • 136
-2

Wow, there has got to be something else going on in that CMAKE file that isn't happening with the java project. Are automated test cases being run? There isn't anything fundamental about Java that would make it compile orders of magnitude (or any) faster than C++ code.

AgileJon
  • 53,070
  • 5
  • 41
  • 38