Hi all,
I've been experimenting with various big repositories and efficient
repository conversions. One of the somewhat surprising findings was that
adding the vendor branches for the NetBSD repository bumped the size
from 2.2GB to 3GB. I've attached an experimental patch to reduce it to the
original size. It is relatively dumb and can certainly be improved.
Also attached is the runtime of fossil open before and after for
comparison.

Joerg
CHANGED src/content.c
Index: src/content.c
===================================================================
--- src/content.c
+++ src/content.c
@@ -758,10 +758,45 @@
 */
 void test_content_deltify_cmd(void){
   if( g.argc!=5 ) usage("RID SRCID FORCE");
   db_must_be_within_tree();
   content_deltify(atoi(g.argv[2]), atoi(g.argv[3]), atoi(g.argv[4]));
+}
+
+/*
+** COMMAND: test-all-deltas
+**
+** Try more aggressively to create cross-branch deltas.
+**/
+void test_all_deltas(void){
+  Stmt q;
+  db_find_and_open_repository(OPEN_ANY_SCHEMA, 2);
+  char filename[1024];
+  int refrid;
+  int step;
+
+  db_begin_transaction();
+  *filename = 0;
+  db_prepare(&q, "SELECT filename.name, mlink.fid FROM mlink, filename"
+    " WHERE NOT EXISTS(SELECT 1 FROM delta WHERE rid=fid)"
+    " AND mlink.fnid=filename.fnid"
+    " ORDER BY filename.name, -mlink.fid");
+  step = 0;
+  while( db_step(&q)==SQLITE_ROW ){
+    const char *curfile = db_column_text(&q, 0);
+    int rid = db_column_int(&q, 1);
+    if (strcmp(curfile, filename)) {
+      strcpy(filename, curfile);
+      refrid = rid;
+      continue;
+    }
+    content_deltify(rid, refrid, 0);
+    if (++step % 100 == 0) fprintf(stderr, ".");
+  }
+  fprintf(stderr, "\n");
+  db_finalize(&q);
+  db_end_transaction(0);
 }
 
 /*
 ** COMMAND: test-integrity
 **

Before:
trunk

real    0m36.977s
user    0m31.220s
sys     0m5.590s

real    0m36.787s
user    0m31.030s
sys     0m5.640s

real    0m36.892s
user    0m30.720s
sys     0m6.030s

netbsd-1-6

real    0m21.366s
user    0m18.370s
sys     0m2.920s

real    0m21.460s
user    0m18.330s
sys     0m3.050s

real    0m21.274s
user    0m18.280s
sys     0m2.920s

After:
trunk

real    0m38.953s
user    0m33.020s
sys     0m5.790s

real    0m39.213s
user    0m32.940s
sys     0m6.140s

real    0m38.972s
user    0m32.680s
sys     0m6.150s

netbsd-1-6

real    0m22.490s
user    0m19.490s
sys     0m2.920s

real    0m22.613s
user    0m19.590s
sys     0m2.940s

real    0m22.580s
user    0m19.740s
sys     0m2.760s

_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to