Skip to content

name-rev: improve memory usage

René Scharfe git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest10 patches 15 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10name-rev: rewrite create_or_update_name()builtin/name-rev.c+12 -124 replies
1/10name-rev: rewrite create_or_update_name()builtin/name-rev.c+12 -120 replies
2/10name-rev: remove unused typedefbuiltin/name-rev.c+2 -20 replies
3/10name-rev: respect const qualifierbuiltin/name-rev.c+3 -30 replies
4/10name-rev: don't leak path copy in name_ref()builtin/name-rev.c+3 -11 reply
5/10name-rev: don't _peek() in create_or_update_name()builtin/name-rev.c+4 -100 replies
6/10name-rev: put struct rev_name into commit slabbuiltin/name-rev.c+11 -90 replies
7/10name-rev: factor out get_parent_name()builtin/name-rev.c+14 -130 replies
8/10name-rev: pre-size buffer in get_parent_name()builtin/name-rev.c+14 -62 replies
9/10name-rev: generate name strings only if they are betterbuiltin/name-rev.c+18 -172 replies
10/10name-rev: release unused name stringsbuiltin/name-rev.c+16 -51 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/10] name-rev: improve memory usage

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