diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2018-04-14 17:35:10 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-04-16 12:38:59 +0900 |
commit | ac77d0c370dc5b23ac1ec4a13c754fe7ffa48564 (patch) | |
tree | 44d01cc4c9a8da445b8c0b2a7d9a8ed5adbc16c4 /t/t4252-am-options.sh | |
parent | pack-objects: clarify the use of object_entry::size (diff) | |
download | tgif-ac77d0c370dc5b23ac1ec4a13c754fe7ffa48564.tar.xz |
pack-objects: shrink size field in struct object_entry
It's very very rare that an uncompressed object is larger than 4GB
(partly because Git does not handle those large files very well to
begin with). Let's optimize it for the common case where object size
is smaller than this limit.
Shrink size field down to 31 bits and one overflow bit. If the size is
too large, we read it back from disk. As noted in the previous patch,
we need to return the delta size instead of canonical size when the
to-be-reused object entry type is a delta instead of a canonical one.
Add two compare helpers that can take advantage of the overflow
bit (e.g. if the file is 4GB+, chances are it's already larger than
core.bigFileThreshold and there's no point in comparing the actual
value).
Another note about oe_get_size_slow(). This function MUST be thread
safe because SIZE() macro is used inside try_delta() which may run in
parallel. Outside parallel code, no-contention locking should be dirt
cheap (or insignificant compared to i/o access anyway). To exercise
this code, it's best to run the test suite with something like
make test GIT_TEST_OE_SIZE=4
which forces this code on all objects larger than 3 bytes.
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 't/t4252-am-options.sh')
0 files changed, 0 insertions, 0 deletions