From: Nguyễn Thái Ngọc Duy Date: Thu, 26 Feb 2015 10:52:07 +0000 (+0700) Subject: index-pack: reduce object_entry size to save memory X-Git-Tag: v2.5.0-rc0~138^2~1 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/417305764a90eaf100faaa9ca46cd76ed6b3bcb6?ds=inline;hp=417305764a90eaf100faaa9ca46cd76ed6b3bcb6 index-pack: reduce object_entry size to save memory For each object in the input pack, we need one struct object_entry. On x86-64, this struct is 64 bytes long. Although: - The 8 bytes for delta_depth and base_object_no are only useful when show_stat is set. And it's never set unless someone is debugging. - The three fields hdr_size, type and real_type take 4 bytes each even though they never use more than 4 bits. By moving delta_depth and base_object_no out of struct object_entry and make the other 3 fields one byte long instead of 4, we shrink 25% of this struct. On a 3.4M object repo (*) that's about 53MB. The saving is less impressive compared to index-pack memory use for basic bookkeeping (**), about 16%. (*) linux-2.6.git already has 4M objects as of v3.19-rc7 so this is not an unrealistic number of objects that we have to deal with. (**) 3.4M * (sizeof(object_entry) + sizeof(delta_entry)) = 311MB Brought-up-by: Matthew Sporleder Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano ---