git/reftable
Patrick Steinhardt 7b8abc4d8c reftable/record: use scratch buffer when decoding records
When decoding log records we need a temporary buffer to decode the
reflog entry's name, mail address and message. As this buffer is local
to the function we thus have to reallocate it for every single log
record which we're about to decode, which is inefficient.

Refactor the code such that callers need to pass in a scratch buffer,
which allows us to reuse it for multiple decodes. This reduces the
number of allocations when iterating through reflogs. Before:

    HEAP SUMMARY:
        in use at exit: 13,473 bytes in 122 blocks
      total heap usage: 2,068,487 allocs, 2,068,365 frees, 305,122,946 bytes allocated

After:

    HEAP SUMMARY:
        in use at exit: 13,473 bytes in 122 blocks
      total heap usage: 1,068,485 allocs, 1,068,363 frees, 281,122,886 bytes allocated

Note that this commit also drop some redundant calls to `strbuf_reset()`
right before calling `decode_string()`. The latter already knows to
reset the buffer, so there is no need for these.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-03-05 09:10:06 -08:00
..
LICENSE
basics.c reftable/stack: use `size_t` to track stack length 2024-02-06 12:10:08 -08:00
basics.h reftable/stack: use `size_t` to track stack length 2024-02-06 12:10:08 -08:00
basics_test.c
block.c reftable/record: use scratch buffer when decoding records 2024-03-05 09:10:06 -08:00
block.h reftable/record: use scratch buffer when decoding records 2024-03-05 09:10:06 -08:00
block_test.c reftable: introduce macros to allocate arrays 2024-02-06 12:10:08 -08:00
blocksource.c reftable: introduce macros to allocate arrays 2024-02-06 12:10:08 -08:00
blocksource.h
constants.h
dump.c treewide: remove unnecessary includes in source files 2023-12-26 12:04:31 -08:00
error.c
generic.c treewide: remove unnecessary includes in source files 2023-12-26 12:04:31 -08:00
generic.h
iter.c reftable/merged: remove unnecessary null check for subiters 2024-03-04 10:19:39 -08:00
iter.h reftable/merged: remove unnecessary null check for subiters 2024-03-04 10:19:39 -08:00
merged.c reftable/merged: avoid duplicate pqueue emptiness check 2024-03-04 10:19:40 -08:00
merged.h reftable/merged: make `merged_iter` structure private 2024-03-04 10:19:30 -08:00
merged_test.c reftable/record: convert old and new object IDs to arrays 2024-03-05 09:10:06 -08:00
pq.c reftable: allow inlining of a few functions 2024-03-04 10:19:49 -08:00
pq.h reftable: allow inlining of a few functions 2024-03-04 10:19:49 -08:00
pq_test.c reftable/merged: make subiters own their records 2024-03-04 10:19:39 -08:00
publicbasics.c reftable: introduce macros to allocate arrays 2024-02-06 12:10:08 -08:00
reader.c Merge branch 'ps/reftable-iteration-perf' 2024-02-26 18:10:24 -08:00
reader.h
readwrite_test.c reftable/record: convert old and new object IDs to arrays 2024-03-05 09:10:06 -08:00
record.c reftable/record: use scratch buffer when decoding records 2024-03-05 09:10:06 -08:00
record.h reftable/record: use scratch buffer when decoding records 2024-03-05 09:10:06 -08:00
record_test.c reftable/record: use scratch buffer when decoding records 2024-03-05 09:10:06 -08:00
refname.c reftable: introduce macros to allocate arrays 2024-02-06 12:10:08 -08:00
refname.h
refname_test.c reftable: honor core.fsync 2024-01-23 13:45:27 -08:00
reftable-blocksource.h
reftable-error.h
reftable-generic.h
reftable-iterator.h
reftable-malloc.h
reftable-merged.h reftable/stack: use `size_t` to track stack length 2024-02-06 12:10:08 -08:00
reftable-reader.h
reftable-record.h reftable/record: reuse message when decoding log records 2024-03-05 09:10:06 -08:00
reftable-stack.h
reftable-tests.h
reftable-writer.h reftable: honor core.fsync 2024-01-23 13:45:27 -08:00
stack.c Merge branch 'ps/reftable-styles' 2024-02-12 13:16:10 -08:00
stack.h reftable/stack: index segments with `size_t` 2024-02-06 12:10:08 -08:00
stack_test.c reftable/record: convert old and new object IDs to arrays 2024-03-05 09:10:06 -08:00
system.h reftable/stack: fix race in up-to-date check 2024-01-18 12:02:09 -08:00
test_framework.c reftable: honor core.fsync 2024-01-23 13:45:27 -08:00
test_framework.h reftable: honor core.fsync 2024-01-23 13:45:27 -08:00
tree.c reftable: introduce macros to allocate arrays 2024-02-06 12:10:08 -08:00
tree.h
tree_test.c treewide: remove unnecessary includes in source files 2023-12-26 12:04:31 -08:00
writer.c Merge branch 'ps/reftable-styles' 2024-02-12 13:16:10 -08:00
writer.h reftable: honor core.fsync 2024-01-23 13:45:27 -08:00