tags:

views:

73

answers:

3

I have to compile java code frequently, especially stuff like GWT which take ages to complete. I cannot avoid that overhead but I want to minimized it down with better hardware. Which factor will make these kind of compilation as fast as possible? (I know it's a little subjective, but when come to compilation, I'm sure that some factor are more important than the others).

For example, I think a Dual Core that run at 3.6 GHz/Core may be faster than a Quad Core that run at 2.8 Ghz/Core when It come to compilation (especially when java code / GWT code compilation is currently single threaded).

So, what kind of factor that I should consider when purchase hardware with regards to this specific problem?

Edit:

I find it quite general when talking about these compilation without refer to my specific situation. I'm dealing with GWT & Scala compilation, which is damn slower, although I don't observe a high load over my hard disk during compilation.

Should I make it faster with CPU of 4+ cores of 2.4Ghz or CPU of 2 cores of 3.4Ghz? Will dual 2GB of DDR3 RAM make it faster or a dual 4GB DDR2 make it faster? Will RAID 0 make a big difference?

+1  A: 

Memory is certainly going to be a factor. If the compiler can't keep necessary state in physical memory you're going to take a huge hit in page swaps.

Mark Peters
+2  A: 

RAM and a fast Hard Disk in this case. In the case of latest C++ compilers CPU is also a factor.

John Paul
Hmm, within my observation, my AMD Athlon X2 1.7 2Ghz with 4GB of RAM is way slower than Core 2 Dual 2.4Ghz with 1GB of RAM when compiling GWT. And we are using the same kind of HDD (Hatachi SATA 5400 rpm) and OS (Ubuntu 10.04)
Phương Nguyễn
It is highly possible that the compiler is optimized for Intel CPUS. It also depends on the code that you compile, if it is full of algorithms and is relatively small, then CPU can become the bottleneck. But in most cases, IMHO, the bottleneck is HDD and RAM
John Paul
+1  A: 

Memory and hard drive speed are the most important things. If you compile frequently, more memory should mean more files are accessed from the cache rather than from the file. Writing time is generally HD dependent, and compiling Java usually means writing a lot of separate files.

The file system that you use can have a huge impact here, so can defragmenting your disk.

If memory and HD are not bottlenecks, then the number of cores in your CPU might matter, if your environment is smart enough to make us of them (IMHO most environments do a poor job here).

Also, as with teapots and boiling water, a compiler that is being watched takes longer to compile.

Uri
Phương Nguyễn
IMHO the bottleneck in compilation is usually disk, not CPU. Having to read and write a large number of files (and also calculate dependencies) is usually significantly slower than the cost of compilation.Why are you recompiling the GWT over and over again, btw?
Uri
I don't know. I have GWT compiled by gwt-maven-plugin. Whenever I make a change in java code (even the class may not related to the GWT code at all), then the plugin will recompile.
Phương Nguyễn