diff options
author | Victoria Dye <vdye@github.com> | 2023-11-14 19:53:55 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-11-16 14:03:00 +0900 |
commit | bd98f9774e10808276c13f8438aa3c71093bc6a4 (patch) | |
tree | bfb967ae17de37af5431ecc58a32faea161b61b1 /git-svn.perl | |
parent | 613d9915499ed9d1fd21d743002d17ef972e9e57 (diff) |
ref-filter.c: filter & format refs in the same callback
Update 'filter_and_format_refs()' to try to perform ref filtering &
formatting in a single ref iteration, without an intermediate 'struct
ref_array'. This can only be done if no operations need to be performed on a
pre-filtered array; specifically, if the refs are
- filtered on reachability,
- sorted, or
- formatted with ahead-behind information
they cannot be filtered & formatted in the same iteration. In that case,
fall back on the current filter-then-sort-then-format flow.
This optimization substantially improves memory usage due to no longer
storing a ref array in memory. In some cases, it also dramatically reduces
runtime (e.g. 'git for-each-ref --no-sort --count=1', which no longer loads
all refs into a 'struct ref_array' to printing only the first ref).
Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-svn.perl')
0 files changed, 0 insertions, 0 deletions