]> git.ipfire.org Git - thirdparty/git.git/commit
reftable/record: store "val2" hashes as static arrays
authorPatrick Steinhardt <ps@pks.im>
Wed, 3 Jan 2024 06:22:34 +0000 (07:22 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 3 Jan 2024 17:54:21 +0000 (09:54 -0800)
commitb31e3cc620f926273af9346fbda4ff507f60682e
tree080d5b42fa730d7546659a58d321c66d943c7791
parent7af607c58d7985a0eb70fc3bca6eef8eb2381f14
reftable/record: store "val2" hashes as static arrays

Similar to the preceding commit, convert ref records of type "val2" to
store their object IDs in static arrays instead of allocating them for
every single record.

We're using the same benchmark as in the preceding commit, with `git
show-ref --quiet` in a repository with ~350k refs. This time around
though the effects aren't this huge. Before:

    HEAP SUMMARY:
        in use at exit: 21,163 bytes in 193 blocks
      total heap usage: 1,419,040 allocs, 1,418,847 frees, 62,153,868 bytes allocated

After:

    HEAP SUMMARY:
        in use at exit: 21,163 bytes in 193 blocks
      total heap usage: 1,410,148 allocs, 1,409,955 frees, 61,976,068 bytes allocated

This is because "val2"-type records are typically only stored for peeled
tags, and the number of annotated tags in the benchmark repository is
rather low. Still, it can be seen that this change leads to a reduction
of allocations overall, even if only a small one.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reftable/readwrite_test.c
reftable/record.c
reftable/record_test.c
reftable/reftable-record.h