Skip to main content

Why is the build so slow?

10 replies [Last post]
cowwoc
Offline
Joined: 2003-08-24

I've compiled the JDK once. Now, if I issue "make scsl" a second time I am expecting it to figure out fairly quickly that there is nothing to be rebuilt.

It takes a whopping 45 minutes (!!!) to return to the command-line even though there is nothing to build.

How does Sun honestly expect anyone to submit patches for the JDK when rebuilding it takes so long? I'd like to make a patch, recompile the JDK, test the patch [iterate until patch works]. There is no way I am going to do this with 45 minutes between iterations.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
alanb
Offline
Joined: 2005-08-08

> Is it possible to run the JDK such that it uses build/
/classes instead of rt.jar?

Yep, as long as you don't build the "images" target (which will create rt.jar and do all the other packaging). Use the -verbose option to be sure the classes are loading from the right place.

leouser
Offline
Joined: 2005-12-12

@cowwoc

if your focusing only on the a specific .java file just compile the specific .java file. Then have your -Xbootclasspath pointing towards that file.

so if it was JFileChooser, Id have a directory called:
javax/swing

and my altered JFileChooser.java file would be in there. Then I compile away.

If this is what your doing let me know, I do this all the time so I may be of some assistance. :)

leouser

kellyohair
Offline
Joined: 2004-09-03

There have been constant problems with incremental builds in the JDK. It's a hard thing to police, but when I do find a problem in this area I have tried to fix them. The 45min seems excessive, but if this is a control build maybe that's not out of line. Build time is dependent on so many things.

The advice from the others is good, you need to find the right places to do builds, depending on what you are changing. The hotspot tree only needs to be built if you are changing hotspot. So you can use BUILD_HOTSPOT=false. The plugin does not need to be built normally either, so use BUILD_DEPLOY=false. That just leaves the j2se directory, so if you just build the j2se, you could 'cd j2se/make; make' and limit yourself to that directory. Further diving to the particular make directory might be in order too, after you have done a complete build from the 'make' directory of course.

For the JPDA debugging code I often would: 'cd j2se/make/jpda; make'. Unfortunately I don't have a complete list of what the good make subdirectories are.

Normally during the build the classes tree is used, it's not until the j2se images target is run will the rt.jar be built.

Hope this is of some help.

-kto

cowwoc
Offline
Joined: 2003-08-24

This is excellent advice, but can it be added to the official documentation?

kellyohair
Offline
Joined: 2004-09-03

I'll add an RFE and see what I can do about adding some more information on incremental builds.

We are also currently making a detailed pass over all the build instructions, so expect some updates in other areas too.

-kto

alanb
Offline
Joined: 2005-08-08

Are you building over the network? Is the CPU busy?

Either way, you shouldn't need to do a full build in the control workspace while you are testing and perfecting a fix. Instead you can usually do an incremental build in the area that you are working on. For example, suppose you've a fix in the NIO area. In that case you just need to do:

(cd make/java/nio; gnumake all)

and that will just recompile the changes in that area. Once you get familar with the build system it becomes easy - for example make/java/net and make/sun/net is the build system for the networking libraries, make/java/java is for the core libraries, etc.

Note that when you do these incremental builds in the j2se workspace then it is compiling the classes to build/
/classes so they aren't packaged into rt.jar. You'll need the "images" target for that but for development purposes it should be just fine.

cowwoc
Offline
Joined: 2003-08-24

Is it possible to run the JDK such that it uses build/
/classes instead of rt.jar?

Thanks,
Gili

alexlamsl
Offline
Joined: 2004-09-02
leouser
Offline
Joined: 2005-12-12

wow, you have to rebuild the JDK with each iteration? What the heck are you working on? :)

leouser

cowwoc
Offline
Joined: 2003-08-24

Ok, so obviously I am doing the wrong thing. I am trying to develop a patch for JFileChooser. In such a case, what should I be recompiling on every iteration? and how? :)

Thanks,
Gili