diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-03-04 11:49:35 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-03-04 19:19:49 +0100 |
commit | f1bf54aee30c879b27602aa159264d5e9803c6b7 (patch) | |
tree | 7d615ee7676b7746abb70e918ee9ebf8f73b0a8a /reftable/record.c | |
parent | reftable/record: decode keys in place (diff) | |
download | git-f1bf54aee30c879b27602aa159264d5e9803c6b7.tar.xz git-f1bf54aee30c879b27602aa159264d5e9803c6b7.zip |
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>
Diffstat (limited to 'reftable/record.c')
-rw-r--r-- | reftable/record.c | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/reftable/record.c b/reftable/record.c index b9c6eee88a..367de04600 100644 --- a/reftable/record.c +++ b/reftable/record.c @@ -1176,11 +1176,6 @@ void reftable_record_key(struct reftable_record *rec, struct strbuf *dest) reftable_record_vtable(rec)->key(reftable_record_data(rec), dest); } -uint8_t reftable_record_type(struct reftable_record *rec) -{ - return rec->type; -} - int reftable_record_encode(struct reftable_record *rec, struct string_view dest, int hash_size) { @@ -1302,12 +1297,6 @@ int reftable_log_record_is_deletion(const struct reftable_log_record *log) return (log->value_type == REFTABLE_LOG_DELETION); } -void string_view_consume(struct string_view *s, int n) -{ - s->buf += n; - s->len -= n; -} - static void *reftable_record_data(struct reftable_record *rec) { switch (rec->type) { |