mirror of
https://github.com/git/git.git
synced 2024-10-06 07:31:21 +02:00
Remove unnecessary duplicate_count in fast-import.
There is little reason to be keeping a global duplicate_count value when we also keep it per object type. The global counter can easily be computed at the end, once all processing has completed. This saves us a couple of machine instructions in an unimportant part of code. But it looks slightly better to me to not keep two counters around. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
parent
f70b653429
commit
80144727ac
@ -217,7 +217,6 @@ static unsigned long alloc_count;
|
|||||||
static unsigned long branch_count;
|
static unsigned long branch_count;
|
||||||
static unsigned long branch_load_count;
|
static unsigned long branch_load_count;
|
||||||
static unsigned long object_count;
|
static unsigned long object_count;
|
||||||
static unsigned long duplicate_count;
|
|
||||||
static unsigned long marks_set_count;
|
static unsigned long marks_set_count;
|
||||||
static unsigned long object_count_by_type[1 << TYPE_BITS];
|
static unsigned long object_count_by_type[1 << TYPE_BITS];
|
||||||
static unsigned long duplicate_count_by_type[1 << TYPE_BITS];
|
static unsigned long duplicate_count_by_type[1 << TYPE_BITS];
|
||||||
@ -765,7 +764,6 @@ static int store_object(
|
|||||||
if (mark)
|
if (mark)
|
||||||
insert_mark(mark, e);
|
insert_mark(mark, e);
|
||||||
if (e->offset) {
|
if (e->offset) {
|
||||||
duplicate_count++;
|
|
||||||
duplicate_count_by_type[type]++;
|
duplicate_count_by_type[type]++;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1722,7 +1720,7 @@ int main(int argc, const char **argv)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned long est_obj_cnt = object_entry_alloc;
|
unsigned long est_obj_cnt = object_entry_alloc;
|
||||||
struct stat sb;
|
unsigned long duplicate_count;
|
||||||
|
|
||||||
setup_ident();
|
setup_ident();
|
||||||
git_config(git_default_config);
|
git_config(git_default_config);
|
||||||
@ -1784,6 +1782,9 @@ int main(int argc, const char **argv)
|
|||||||
if (branch_log)
|
if (branch_log)
|
||||||
fclose(branch_log);
|
fclose(branch_log);
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(duplicate_count_by_type); i++)
|
||||||
|
duplicate_count += duplicate_count_by_type[i];
|
||||||
|
|
||||||
fprintf(stderr, "%s statistics:\n", argv[0]);
|
fprintf(stderr, "%s statistics:\n", argv[0]);
|
||||||
fprintf(stderr, "---------------------------------------------------------------------\n");
|
fprintf(stderr, "---------------------------------------------------------------------\n");
|
||||||
fprintf(stderr, "Alloc'd objects: %10lu (%10lu overflow )\n", alloc_count, alloc_count - est_obj_cnt);
|
fprintf(stderr, "Alloc'd objects: %10lu (%10lu overflow )\n", alloc_count, alloc_count - est_obj_cnt);
|
||||||
|
Loading…
Reference in New Issue
Block a user