Florian Festi wrote:
Hi!

I put together my patches in my own working dir (as proposed by James Bowes ;)= ) to see if they have the expected performance gain and if they fit together. It turned out that the performance gain is within the expected range and that it is possible to achieve that with increasing the code base by only 20 lines. My test cases report the following timings:

real time in seconds
--------------------------------
Warmup: Full install    | 137.92
Resolve normal install  |  27.28
Resolve full install    | 170.79
Resolve install [a-k]*  | 191.09
Resolve empty update    |   7.92
Resolve update libgnome |  11.96
Resolve big update      |  19.13
Resolve erase glibc     |  33.67
Warmup: Dist upgrade    |  18.65
Resolve dist upgrade    |  20.30

Ops... these results (especially the updates) can only be reached with an index on the requires names. Linear search on disk is even slower than linear search in memory...

Attached patch to yum-metadata-parser adds them. One patch adds name indices to all Prco the other just to provides and requires.

Florian

Index: db.c
===================================================================
RCS file: /cvsroot/yum/cvs/yum-metadata-parser/db.c,v
retrieving revision 1.9
diff -u -r1.9 db.c
--- db.c	10 Apr 2007 22:30:41 -0000	1.9
+++ db.c	6 Jun 2007 07:43:42 -0000
@@ -393,6 +393,7 @@
     int i;
 
     const char *indexsql = "CREATE INDEX IF NOT EXISTS pkg%s on %s (pkgKey)";
+    const char *indexsql2 = "CREATE INDEX IF NOT EXISTS %sname on %s (name)";
 
     for (i = 0; deps[i]; i++) {
         const char *prereq;
@@ -424,15 +425,18 @@
                          deps[i], sqlite3_errmsg (db));
             return;
         }
-    }
 
-    sql = "CREATE INDEX providesname ON provides (name)";
-    rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
-    if (rc != SQLITE_OK) {
-        g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
-                     "Can not create providesname index: %s",
-                     sqlite3_errmsg (db));
-        return;
+        query = g_strdup_printf(indexsql2, deps[i], deps[i]);
+        rc = sqlite3_exec (db, query, NULL, NULL, NULL);
+        g_free (query);
+
+        if (rc != SQLITE_OK) {
+            g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
+                         "Can not create index on %s table: %s",
+                         deps[i], sqlite3_errmsg (db));
+            return;
+        }
+
     }
 
     sql =
Index: db.c
===================================================================
RCS file: /cvsroot/yum/cvs/yum-metadata-parser/db.c,v
retrieving revision 1.9
diff -u -r1.9 db.c
--- db.c	10 Apr 2007 22:30:41 -0000	1.9
+++ db.c	6 Jun 2007 07:47:03 -0000
@@ -393,6 +393,7 @@
     int i;
 
     const char *indexsql = "CREATE INDEX IF NOT EXISTS pkg%s on %s (pkgKey)";
+    const char *indexsql2 = "CREATE INDEX IF NOT EXISTS %sname on %s (name)";
 
     for (i = 0; deps[i]; i++) {
         const char *prereq;
@@ -424,15 +425,21 @@
                          deps[i], sqlite3_errmsg (db));
             return;
         }
-    }
 
-    sql = "CREATE INDEX providesname ON provides (name)";
-    rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
-    if (rc != SQLITE_OK) {
-        g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
-                     "Can not create providesname index: %s",
-                     sqlite3_errmsg (db));
-        return;
+        /* build name indices for provides, requires */
+        if (i < 2) { 
+            query = g_strdup_printf(indexsql2, deps[i], deps[i]);
+            rc = sqlite3_exec (db, query, NULL, NULL, NULL);
+            g_free (query);
+
+            if (rc != SQLITE_OK) {
+                g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
+                             "Can not create index on %s table: %s",
+                             deps[i], sqlite3_errmsg (db));
+                return;
+            }
+        }
+
     }
 
     sql =
_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to