Commit 4173057
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 <[email protected]>
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent 9874fca commit 4173057
1 file changed
+19
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| |||
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| 70 | + | |
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
| |||
873 | 877 | | |
874 | 878 | | |
875 | 879 | | |
876 | | - | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
877 | 883 | | |
878 | | - | |
879 | | - | |
| 884 | + | |
| 885 | + | |
880 | 886 | | |
| 887 | + | |
881 | 888 | | |
882 | | - | |
883 | 889 | | |
884 | 890 | | |
885 | 891 | | |
| |||
902 | 908 | | |
903 | 909 | | |
904 | 910 | | |
905 | | - | |
| 911 | + | |
906 | 912 | | |
907 | 913 | | |
908 | 914 | | |
| |||
1499 | 1505 | | |
1500 | 1506 | | |
1501 | 1507 | | |
1502 | | - | |
| 1508 | + | |
1503 | 1509 | | |
1504 | 1510 | | |
1505 | 1511 | | |
| |||
1508 | 1514 | | |
1509 | 1515 | | |
1510 | 1516 | | |
1511 | | - | |
1512 | | - | |
| 1517 | + | |
| 1518 | + | |
1513 | 1519 | | |
1514 | 1520 | | |
1515 | 1521 | | |
| |||
1672 | 1678 | | |
1673 | 1679 | | |
1674 | 1680 | | |
| 1681 | + | |
| 1682 | + | |
1675 | 1683 | | |
1676 | 1684 | | |
1677 | 1685 | | |
| |||
0 commit comments