pack-objects: move tree_depth into 'struct packing_data'
This reduces the size of 'struct object_entry' and therefore makes packing objects more efficient. This also renames cmp_tree_depth() into tree_depth_compare(), as it is more modern to have the name of the compare functions end with "compare". Helped-by: Jeff King <peff@peff.net> Helped-by: Duy Nguyen <pclouds@gmail.com> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
9eb0986fa0
commit
108f530385
@ -101,7 +101,6 @@ struct object_entry {
|
||||
unsigned no_try_delta:1;
|
||||
unsigned in_pack_type:TYPE_BITS; /* could be delta */
|
||||
|
||||
unsigned int tree_depth; /* should be repositioned for packing? */
|
||||
unsigned char layer;
|
||||
|
||||
unsigned preferred_base:1; /*
|
||||
@ -145,6 +144,9 @@ struct packing_data {
|
||||
struct packed_git **in_pack;
|
||||
|
||||
uintmax_t oe_size_limit;
|
||||
|
||||
/* delta islands */
|
||||
unsigned int *tree_depth;
|
||||
};
|
||||
|
||||
void prepare_packing_data(struct packing_data *pdata);
|
||||
@ -350,4 +352,21 @@ static inline void oe_set_delta_size(struct packing_data *pack,
|
||||
"where delta size is the same as entry size");
|
||||
}
|
||||
|
||||
static inline unsigned int oe_tree_depth(struct packing_data *pack,
|
||||
struct object_entry *e)
|
||||
{
|
||||
if (!pack->tree_depth)
|
||||
return 0;
|
||||
return pack->tree_depth[e - pack->objects];
|
||||
}
|
||||
|
||||
static inline void oe_set_tree_depth(struct packing_data *pack,
|
||||
struct object_entry *e,
|
||||
unsigned int tree_depth)
|
||||
{
|
||||
if (!pack->tree_depth)
|
||||
ALLOC_ARRAY(pack->tree_depth, pack->nr_objects);
|
||||
pack->tree_depth[e - pack->objects] = tree_depth;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user