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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

-- 
Ziga
Index: libjava/gnu/gcj/tools/gcj_dbtool/Main.java
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/gnu/gcj/tools/gcj_dbtool/Main.java,v
retrieving revision 1.6
diff -u -r1.6 Main.java
--- libjava/gnu/gcj/tools/gcj_dbtool/Main.java	7 Mar 2005 20:16:25 -0000	1.6
+++ libjava/gnu/gcj/tools/gcj_dbtool/Main.java	11 Mar 2005 01:40:36 -0000
@@ -89,7 +89,7 @@
 	    PersistentByteMap map; 
 	    if (database.isFile())
 	      map = new PersistentByteMap(database, 
-					  PersistentByteMap.AccessMode.READ_ONLY);
+					  PersistentByteMap.AccessMode.READ_WRITE);
 	    else
 	      map = PersistentByteMap.emptyPersistentByteMap(database, 
 							     100, 100*32);
@@ -355,7 +355,8 @@
   static PersistentByteMap resizeMap(PersistentByteMap m, int newCapacity, boolean close)
     throws IOException, IllegalAccessException
   {
-    newCapacity = Math.max(m.capacity(), newCapacity);
+    if (newCapacity <= m.capacity())
+      return m;
     File name = m.getFile();
     File copy = File.createTempFile(name.getName(), "", name.getParentFile());
     try

[Index of Archives]     [Red Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux