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

Re: [PATCH/RFC v3 08/12] pack-objects: refer to delta objects by index instead of pointer

From: Junio C Hamano <hidden>
Date: 2018-03-14 16:19:05

Nguyễn Thái Ngọc Duy  [off-list ref] writes:
Notice that packing_data::nr_objects is uint32_t, we could only handle
maximum 4G objects and can address all of them with an uint32_t. If we
use a pointer here, we waste 4 bytes on 64 bit architecture.
Some things are left unsaid or left unclear and make readers stutter
a bit while reading this paragraph.  We can address them with
uint32_t only because we happen to have a linear array of all
objects involved already, i.e. the pack->objects[] array.  The
readers are forced to rephrase the above in their mind

	... and each of them can be identified with an uint32_t.
	Because we have all of these objects in pack->objects[], we
	can replace the "delta" field in each object entry that
	points at its delta base object with uint32_t index into
	this array to save memory (on 64-bit arch, 8-byte pointer
	gets shrunk to 4-byte uint).

or something like that before understanding why this is a valid
memory footprint optimization.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help