diff options
author | Christian Couder <christian.couder@gmail.com> | 2018-08-16 08:13:12 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-16 10:56:44 -0700 |
commit | 108f530385e969feab343b2b8acadeb7bb670009 (patch) | |
tree | 311cbc0c573fbb5fc0ef4d6697bb017f3752288f /pack-objects.h | |
parent | 9eb0986fa0b417911ed126e0d6d12028b9c2044f (diff) | |
download | git-108f530385e969feab343b2b8acadeb7bb670009.tar.gz |
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>
Diffstat (limited to 'pack-objects.h')
-rw-r--r-- | pack-objects.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/pack-objects.h b/pack-objects.h index 8eecd67991..3cb5527eeb 100644 --- a/pack-objects.h +++ b/pack-objects.h @@ -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 |