How to speed up Hotspot Build

Erik Trimble Erik.Trimble at Sun.COM
Sun Feb 8 03:47:34 UTC 2009


Just for reference, here's some comparative data:

Here at Sun, on a dual 2.2Ghz Opteron w/ 4gb of RAM, it takes around 30 
minutes to do a build.

The parameters you've set are reasonable, though as Kelly indicated, 
just look at the 'hotspot/make/Makefile' to build the VM by itself (that 
is, you don't have to invoke Make from the top-level JDK directory, you 
can do it from inside the hotspot directory, referencing the above 

That said, here's a few things that might speed up your build:

(1) look for a tool called 'ccache', which is _very_ useful in caching 
outputs from GCC so that rebuilding time can be cut down quite a bit.

(2)  build in a ramdisk. This is by far going to be the biggest speedup, 
as a major issue in build times is disk I/O.   Look here on Wikipedia 
for info about how to use TMPFS under Linux:
if you can't fit the entire source and object code in a tmpfs, then at 
least set the TMPDIR env variable to point to a  tmpfs location, so that 
the object and intermediary code files get built in ram.

(3)  If you only have a dual-core system (i'm assuming some sort of Core 
2 Duo machine, or an older Pentium D), than I would recommend using only 
3 build threads, not 4.  Hyperthreading is nowhere near as efficient as 
a "real" core, and the associated context switching is expensive. For a 
build, where you are doing large numbers of relatively small (and 
short-lived) processes, hyperthreading is inefficient (for a variety of 
reasons) and is probably actually hurting you more than helping.


Peng Du wrote:
> Hello, guys
> Recently, I am working on some slight modifications of Hotspot VM 
> without touching the JDK part. So, I have to compile Hotspot quite 
> frequently. However, the build is awfully slow on my machine with a 
> Intel 2.4G dual core CPU, 3G memory, and OpenSUSE11. It takes about 
> 2-3 hours for one build.
> Here is the relevant fragment of my build script:
> ==================================
> export MAKE_VERBOSE=true
> export DEBUG_GDB3=true
> export ARCH_DATA_MODEL=32
> export BUILD_HOTSPOT=true
> export BUILD_LANGTOOLS=false
> export BUILD_JDK=false
> export BUILD_JAXP=false
> export BUILD_JAXWS=false
> export BUILD_CORBA=false
> export BUILD_DEPLOY=false
> export BUILD_J2SE=false
> export DEV_ONLY=true
> export SKIP_DEBUG_BUILD=false
> ==================================
> Any ideas on how to tune this to speed up the build? Or, are there 
> problems with the script?
> Thanks!
> Peng Du
> 2/7/2009

Erik Trimble
Java System Support
Mailstop:  usca22-123
Phone:  x17195
Santa Clara, CA
Timezone: US/Pacific (GMT-0800)

More information about the build-dev mailing list