Thread (1 message) 1 message, 1 author, 2018-03-16

Re: [PATCH v4 07/11] pack-objects: refer to delta objects by index instead of pointer

From: Junio C Hamano <hidden>
Date: 2018-03-16 20:59:09

Nguyễn Thái Ngọc Duy  [off-list ref] writes:
These delta pointers always point to elements in the objects[] array
in packing_data struct. We can only hold maximum 4GB of those objects
4GB, as in "number of bytes"?  Or "We can hold 4 billion or so of
those objects"?
because the array length, nr_objects, is uint32_t. We could use
uint32_t indexes to address these elements instead of pointers. On
64-bit architecture (8 bytes per pointer) this would save 4 bytes per
pointer.

Convert these delta pointers to indexes. Since we need to handle NULL
pointers as well, the index is shifted by one [1].

[1] This means we can only index 2^32-2 objects even though nr_objects
    could contain 2^32-1 objects. It should not be a problem in
    practice because when we grow objects[], nr_alloc would probably
    blow up long before nr_objects hits the wall.
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help