git/reftable
Patrick Steinhardt dd347bbce6 reftable/block: reuse uncompressed blocks
The reftable backend stores reflog entries in a compressed format and
thus needs to uncompress blocks before one can read records from it.
For each reflog block we thus have to allocate an array that we can
decompress the block contents into. This block is being discarded
whenever the table iterator moves to the next block. Consequently, we
reallocate a new array on every block, which is quite wasteful.

Refactor the code to reuse the uncompressed block data when moving the
block reader to a new block. This significantly reduces the number of
allocations when iterating through many compressed blocks. The following
measurements are done with `git reflog list` when listing 100k reflogs.
Before:

  HEAP SUMMARY:
      in use at exit: 13,473 bytes in 122 blocks
    total heap usage: 45,755 allocs, 45,633 frees, 254,779,456 bytes allocated

After:

  HEAP SUMMARY:
      in use at exit: 13,473 bytes in 122 blocks
    total heap usage: 23,028 allocs, 22,906 frees, 162,813,547 bytes allocated

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-04-15 10:36:09 -07:00
..
LICENSE
basics.c reftable/block: fix error handling when searching restart points 2024-04-03 09:16:50 -07:00
basics.h reftable/block: fix error handling when searching restart points 2024-04-03 09:16:50 -07:00
basics_test.c reftable/basics: improve `binsearch()` test 2024-04-03 09:16:49 -07:00
block.c reftable/block: reuse uncompressed blocks 2024-04-15 10:36:09 -07:00
block.h reftable/block: reuse uncompressed blocks 2024-04-15 10:36:09 -07:00
block_test.c reftable/block: merge `block_iter_seek()` and `block_reader_seek()` 2024-04-15 10:36:09 -07:00
blocksource.c
blocksource.h
constants.h
dump.c
error.c reftable/error: discern locked/outdated errors 2024-03-25 09:51:11 -07:00
generic.c
generic.h
iter.c reftable/block: rename `block_reader_start()` 2024-04-15 10:36:09 -07: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
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
reader.c reftable/block: reuse uncompressed blocks 2024-04-15 10:36:09 -07: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: extract function to decode key lengths 2024-04-03 09:16:50 -07:00
record.h reftable/record: extract function to decode key lengths 2024-04-03 09:16:50 -07:00
record_test.c reftable/record: use scratch buffer when decoding records 2024-03-05 09:10:06 -08:00
refname.c reftable/refname: refactor binary search over refnames 2024-04-03 09:16:50 -07:00
refname.h
refname_test.c
reftable-blocksource.h
reftable-error.h reftable/error: discern locked/outdated errors 2024-03-25 09:51:11 -07:00
reftable-generic.h
reftable-iterator.h
reftable-malloc.h
reftable-merged.h
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
stack.c reftable/stack: gracefully handle failed auto-compaction due to locks 2024-03-25 09:54:07 -07:00
stack.h
stack_test.c Merge branch 'ps/pack-refs-auto' 2024-04-09 14:31:45 -07:00
system.h reftable/stack: register lockfiles during compaction 2024-03-07 12:34:13 -08:00
test_framework.c
test_framework.h
tree.c
tree.h
tree_test.c
writer.c
writer.h