reftable: allow inlining of a few functions
commitf1bf54aee30c879b27602aa159264d5e9803c6b7
authorPatrick Steinhardt <ps@pks.im>
Mon, 4 Mar 2024 10:49:35 +0000 (4 11:49 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 4 Mar 2024 18:19:49 +0000 (4 10:19 -0800)
tree7d615ee7676b7746abb70e918ee9ebf8f73b0a8a
parentdaf4f43d0d84234c2308c95ba63e54bdb8846859
reftable: allow inlining of a few functions

We have a few functions which are basically just accessors to
structures. As those functions are executed inside the hot loop when
iterating through many refs, the fact that they cannot be inlined is
costing us some performance.

Move the function definitions into their respective headers so that they
can be inlined. This results in a performance improvement when iterating
over 1 million refs:

    Benchmark 1: show-ref: single matching ref (revision = HEAD~)
      Time (mean ± σ):     105.9 ms ±   3.6 ms    [User: 103.0 ms, System: 2.8 ms]
      Range (min … max):   103.1 ms … 133.4 ms    1000 runs

    Benchmark 2: show-ref: single matching ref (revision = HEAD)
      Time (mean ± σ):     100.7 ms ±   3.4 ms    [User: 97.8 ms, System: 2.8 ms]
      Range (min … max):    97.8 ms … 124.0 ms    1000 runs

    Summary
      show-ref: single matching ref (revision = HEAD) ran
        1.05 ± 0.05 times faster than show-ref: single matching ref (revision = HEAD~)

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