[fedora-java] [Patch] Improving gcj-dbtool performance

Andrew Haley aph at redhat.com
Fri Mar 11 10:02:05 UTC 2005


Ziga Mahkovec writes:
 > I noticed that installing the eclipse-* packages takes really long
 > (around 10 minutes on my laptop).  Most of time is spent running gcj-
 > dbtool, doing lots of disk IO.
 > 
 > This seemed a bit unusual and after inspecting the gcj-dbtool sources, I
 > found out that in resizeMap(), a new PersistentByteMap is created for
 > each jar package that is added -- amounting to almost 150 several-MB
 > temporary files created.  I don't think this was intentional.
 >
 > The attached patch cuts my installation time for eclipse-platform from
 > 7m17s to 1m35s.  I've verified that eclipse.db is identical to the old
 > database, so hopefully the patch doesn't break anything.

This is wrong.

Other running applications may be accessing a .db file while it is in
place, and it is not safe to modify it.  The right technique is to
copy the old file to a new one, add to the new one, and then rename
it.  Any processes that have the old one mapped will continue to use
it.

The problem is that the Eclipse installer is doing things in a very
inefficient way.  The most efficient way is to generate a separate map
for each jar file, and then merge them all at the end.  This is very
fast.  It also has the advantage that the resulting file is more
compact.

Andrew.




More information about the java-devel mailing list