pack-objects: move 'layer' into 'struct packing_data'
This reduces the size of 'struct object_entry' from 88 bytes to 80 and therefore makes packing objects more efficient. For example on a Linux repo with 12M objects, `git pack-objects --all` needs extra 96MB memory even if the layer feature is not used. 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
108f530385
commit
fe0ac2fb7f
@ -101,8 +101,6 @@ struct object_entry {
|
||||
unsigned no_try_delta:1;
|
||||
unsigned in_pack_type:TYPE_BITS; /* could be delta */
|
||||
|
||||
unsigned char layer;
|
||||
|
||||
unsigned preferred_base:1; /*
|
||||
* we do not pack this, but is available
|
||||
* to be used as the base object to delta
|
||||
@ -147,6 +145,7 @@ struct packing_data {
|
||||
|
||||
/* delta islands */
|
||||
unsigned int *tree_depth;
|
||||
unsigned char *layer;
|
||||
};
|
||||
|
||||
void prepare_packing_data(struct packing_data *pdata);
|
||||
@ -369,4 +368,21 @@ static inline void oe_set_tree_depth(struct packing_data *pack,
|
||||
pack->tree_depth[e - pack->objects] = tree_depth;
|
||||
}
|
||||
|
||||
static inline unsigned char oe_layer(struct packing_data *pack,
|
||||
struct object_entry *e)
|
||||
{
|
||||
if (!pack->layer)
|
||||
return 0;
|
||||
return pack->layer[e - pack->objects];
|
||||
}
|
||||
|
||||
static inline void oe_set_layer(struct packing_data *pack,
|
||||
struct object_entry *e,
|
||||
unsigned char layer)
|
||||
{
|
||||
if (!pack->layer)
|
||||
ALLOC_ARRAY(pack->layer, pack->nr_objects);
|
||||
pack->layer[e - pack->objects] = layer;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user