git/trace2
Patrick Steinhardt 1869525066 refs/reftable: wire up support for exclude patterns
Exclude patterns can be used by reference backends to skip over blocks
of references that are uninteresting to the caller. Reference backends
do not have to wire up support for them, and all callers are expected to
behave as if the backend didn't support them. In fact, the only backend
that supports exclude patterns right now is the "packed" backend.

Exclude patterns can be quite an important performance optimization in
repositories that have loads of references. The patterns are set up in
case "transfer.hideRefs" and friends are configured during a fetch, so
handling these patterns becomes important once there are lots of hidden
refs in a served repository.

Now that we have properly re-seekable reftable iterators we can also
wire up support for these patterns in the "reftable" backend. Doing so
is conceptually simple: once we hit a reference whose prefix matches the
current exclude pattern we re-seek the iterator to the first reference
that doesn't match the pattern anymore. This schema only works for
trivial patterns that do not have any globbing characters in them, but
this restriction also applies do the "packed" backend.

This makes t1419 work with the "reftable" backend with some slight
modifications. Of course it also speeds up listing of references with
hidden refs. The following benchmark prints one reference with 1 million
hidden references:

    Benchmark 1: HEAD~
      Time (mean ± σ):      93.3 ms ±   2.1 ms    [User: 90.3 ms, System: 2.5 ms]
      Range (min … max):    89.8 ms …  97.2 ms    33 runs

    Benchmark 2: HEAD
      Time (mean ± σ):       4.2 ms ±   0.6 ms    [User: 2.2 ms, System: 1.8 ms]
      Range (min … max):     3.1 ms …   8.1 ms    765 runs

    Summary
      HEAD ran
       22.15 ± 3.19 times faster than HEAD~

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-09-16 13:57:19 -07:00
..
tr2_cfg.c Merge branch 'gc/config-context' 2023-07-06 11:54:48 -07:00
tr2_cfg.h trace2: teach Git to log environment variables 2020-03-23 13:14:53 -07:00
tr2_cmd_name.c treewide: remove unnecessary includes of cache.h 2023-03-21 10:56:53 -07:00
tr2_cmd_name.h
tr2_ctr.c refs/reftable: wire up support for exclude patterns 2024-09-16 13:57:19 -07:00
tr2_ctr.h trace2: add global counter mechanism 2022-10-24 12:45:26 -07:00
tr2_dst.c treewide: remove unnecessary includes of cache.h 2023-03-21 10:56:53 -07:00
tr2_dst.h trace2: write discard message to sentinel files 2019-10-05 17:53:51 +09:00
tr2_sid.c treewide: remove unnecessary includes of cache.h 2023-03-21 10:56:53 -07:00
tr2_sid.h
tr2_sysenv.c trace2: handle NULL values in tr2_sysenv config callback 2023-12-09 08:24:47 +09:00
tr2_sysenv.h trace2: teach Git to log environment variables 2020-03-23 13:14:53 -07:00
tr2_tbuf.c treewide: remove unnecessary cache.h includes in source files 2023-02-23 17:25:28 -08:00
tr2_tbuf.h trace2: make SIDs more unique 2019-04-16 13:37:07 +09:00
tr2_tgt_event.c trace2: implement trace2_printf() for event target 2024-08-22 15:02:31 -07:00
tr2_tgt_normal.c trace2/tr2_tls.h: remove unnecessary include 2023-12-26 12:04:32 -08:00
tr2_tgt_perf.c trace2: plumb config kvi 2023-06-28 14:06:39 -07:00
tr2_tgt.h trace2: plumb config kvi 2023-06-28 14:06:39 -07:00
tr2_tls.c trace2/tr2_tls.h: remove unnecessary include 2023-12-26 12:04:32 -08:00
tr2_tls.h trace2/tr2_tls.h: remove unnecessary include 2023-12-26 12:04:32 -08:00
tr2_tmr.c treewide: remove unnecessary includes in source files 2023-12-26 12:04:33 -08:00
tr2_tmr.h trace2: add stopwatch timers 2022-10-24 12:45:26 -07:00