Skip to content

Commit

Permalink
Revert "pack-objects: only throw away data during memory pressure"
Browse files Browse the repository at this point in the history
This reverts commit 9c21743.

Nico analyzed and found out that this does not really help, and
I agree with it.

By the time this gets into action and data is actively thrown
away, performance simply goes down the drain due to the data
constantly being reloaded over and over and over and over and
over and over again, to the point of virtually making no
relative progress at all.  The previous behavior of enforcing
the memory limit by dynamically shrinking the window size at
least had the effect of allowing some kind of progress, even if
the end result wouldn't be optimal.

And that's the whole point behind this memory limiting feature:
allowing some progress to be made when resources are too limited
to let the repack go unbounded.
  • Loading branch information
Junio C Hamano committed Feb 13, 2008
1 parent 6c47d0e commit 75ad235
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions builtin-pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,7 @@ static unsigned int check_delta_limit(struct object_entry *me, unsigned int n)
return m;
}

static unsigned long free_unpacked_data(struct unpacked *n)
static unsigned long free_unpacked(struct unpacked *n)
{
unsigned long freed_mem = sizeof_delta_index(n->index);
free_delta_index(n->index);
Expand All @@ -1474,12 +1474,6 @@ static unsigned long free_unpacked_data(struct unpacked *n)
free(n->data);
n->data = NULL;
}
return freed_mem;
}

static unsigned long free_unpacked(struct unpacked *n)
{
unsigned long freed_mem = free_unpacked_data(n);
n->entry = NULL;
n->depth = 0;
return freed_mem;
Expand Down Expand Up @@ -1520,7 +1514,7 @@ static void find_deltas(struct object_entry **list, unsigned *list_size,
mem_usage > window_memory_limit &&
count > 1) {
uint32_t tail = (idx + window - count) % window;
mem_usage -= free_unpacked_data(array + tail);
mem_usage -= free_unpacked(array + tail);
count--;
}

Expand Down Expand Up @@ -1553,9 +1547,6 @@ static void find_deltas(struct object_entry **list, unsigned *list_size,
if (!m->entry)
break;
ret = try_delta(n, m, max_depth, &mem_usage);
if (window_memory_limit &&
mem_usage > window_memory_limit)
mem_usage -= free_unpacked_data(m);
if (ret < 0)
break;
else if (ret > 0)
Expand Down

0 comments on commit 75ad235

Please sign in to comment.