diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2015-02-26 17:52:07 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-02-27 12:23:25 -0800 |
commit | 417305764a90eaf100faaa9ca46cd76ed6b3bcb6 (patch) | |
tree | bc2b140fda8e5c3fdf2b109f07fc4482c9a19f23 /trailer.h | |
parent | Git 2.3 (diff) | |
download | tgif-417305764a90eaf100faaa9ca46cd76ed6b3bcb6.tar.xz |
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 <msporleder@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'trailer.h')
0 files changed, 0 insertions, 0 deletions