[PATCH 00/10] name-rev: improve memory usage
- From
René Scharfe <l.s.r@web.de>
- Date
- Feb 4, 2020, 21:12 UTC
- Message-ID
- <084909f8-fefa-1fe0-b2ce-74eff47c4972@web.de>
This series seeks to get reduce the size of memory allocations, the number of reallocations and the amount of leaks in git name-rev, to improve its performance. It starts with a few cleanups:
Martin Ågren (1): name-rev: rewrite create_or_update_name()
René Scharfe (9): name-rev: remove unused typedef name-rev: respect const qualifier name-rev: don't _peek() in create_or_update_name()
... then plugs a minor leak:
name-rev: don't leak path copy in name_ref()
... and gets rid of a level of indirection in commit slab usage:
name-rev: put struct rev_name into commit slab
The next two patches eliminate reallocations while building name strings for parent commits, which can make a surprisingly big difference in some cases:
name-rev: factor out get_parent_name() name-rev: pre-size buffer in get_parent_name()
The next one avoids building names that are be discarded right away by checking first if they are better than a possibly present other name assigned earlier, which only provides a small speedup, but is the right thing to do:
name-rev: generate name strings only if they are better
And finally a tricky one whose commit message is a lot longer than its diff, which adds a bit of overhead and which probably needs the most reviewer attention to make sure it won't cause double frees:
name-rev: release unused name strings
builtin/name-rev.c | 133 ++++++++++++++++++++++++++------------------- 1 file changed, 76 insertions(+), 57 deletions(-)
-- 2.25.0