reftable/record: convert old and new object IDs to arrays

In 7af607c58d (reftable/record: store "val1" hashes as static arrays,
2024-01-03) and b31e3cc620 (reftable/record: store "val2" hashes as
static arrays, 2024-01-03) we have converted ref records to store their
object IDs in a static array. Convert log records to do the same so that
their old and new object IDs are arrays, too.

This change results in two allocations less per log record that we're
iterating over. Before:

    HEAP SUMMARY:
        in use at exit: 13,473 bytes in 122 blocks
      total heap usage: 8,068,495 allocs, 8,068,373 frees, 401,011,862 bytes allocated

After:

    HEAP SUMMARY:
        in use at exit: 13,473 bytes in 122 blocks
      total heap usage: 6,068,489 allocs, 6,068,367 frees, 361,011,822 bytes allocated

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2024-03-05 13:10:59 +01:00
committed by Junio C Hamano
parent eea0d11d6d
commit 87ff723018
7 changed files with 61 additions and 151 deletions

View File

@ -88,8 +88,8 @@ struct reftable_log_record {
union {
struct {
uint8_t *new_hash;
uint8_t *old_hash;
unsigned char new_hash[GIT_MAX_RAWSZ];
unsigned char old_hash[GIT_MAX_RAWSZ];
char *name;
char *email;
uint64_t time;