@matheusbsbs / matheus-bagliano / commits / d6c7eb2c16
Fork 0

Added branch load counter to fast-import.

If the branch load count exceeds the number of branches created then the frontend is causing fast-import to page branches into and out of memory due to the way its ordering its commits. Performance can likely be increased if the frontend were to alter its commit sequence such that it stays on one branch before switching to another branch, then never returns to the prior branch. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Aug 23, 2006 at 04:31 UTC d6c7eb2c160fc40c48fd25fdae15c193eec13bb7
1 file changed +4 -2
fast-import.c
+4 -2
@@ -190,6 +190,7 @@ struct branch
190 static unsigned long max_depth = 10;
191 static unsigned long alloc_count;
192 static unsigned long branch_count;
193 +static unsigned long branch_load_count;
194 static unsigned long object_count;
195 static unsigned long duplicate_count;
196 static unsigned long marks_set_count;
@@ -1059,6 +1060,7 @@ static void load_branch(struct branch *b)
1060 b->active_next_branch = active_branches;
1061 active_branches = b;
1062 cur_active_branches++;
1063 + branch_load_count++;
1064 }
1065
1066 static void file_change_m(struct branch *b)
@@ -1382,9 +1384,9 @@ int main(int argc, const char **argv)
1384 fprintf(stderr, " trees : %10lu (%10lu duplicates)\n", object_count_by_type[OBJ_TREE], duplicate_count_by_type[OBJ_TREE]);
1385 fprintf(stderr, " commits: %10lu (%10lu duplicates)\n", object_count_by_type[OBJ_COMMIT], duplicate_count_by_type[OBJ_COMMIT]);
1386 fprintf(stderr, " tags : %10lu (%10lu duplicates)\n", object_count_by_type[OBJ_TAG], duplicate_count_by_type[OBJ_TAG]);
1385 - fprintf(stderr, "Total branches: %10lu\n", branch_count);
1386 - fprintf(stderr, " atoms: %10u\n", atom_cnt);
1387 + fprintf(stderr, "Total branches: %10lu (%10lu loads )\n", branch_count, branch_load_count);
1388 fprintf(stderr, " marks: %10u (%10lu unique )\n", (1 << marks->shift) * 1024, marks_set_count);
1389 + fprintf(stderr, " atoms: %10u\n", atom_cnt);
1390 fprintf(stderr, "Memory total: %10lu KiB\n", (total_allocd + alloc_count*sizeof(struct object_entry))/1024);
1391 fprintf(stderr, " pools: %10lu KiB\n", total_allocd/1024);
1392 fprintf(stderr, " objects: %10lu KiB\n", (alloc_count*sizeof(struct object_entry))/1024);