Skip to content
  • Nicolas Pitre's avatar
    diff-delta: allow reusing of the reference buffer index · 38fd0721
    Nicolas Pitre authored
    
    
    When a reference buffer is used multiple times then its index can be
    computed only once and reused multiple times.  This patch adds an extra
    pointer to a pointer argument (from_index) to diff_delta() for this.
    
    If from_index is NULL then everything is like before.
    
    If from_index is non NULL and *from_index is NULL then the index is
    created and its location stored to *from_index.  In this case the caller
    has the responsibility to free the memory pointed to by *from_index.
    
    If from_index and *from_index are non NULL then the index is reused as
    is.
    
    This currently saves about 10% of CPU time to repack the git archive.
    
    Signed-off-by: default avatarNicolas Pitre <nico@cam.org>
    Signed-off-by: default avatarJunio C Hamano <junkio@cox.net>
    38fd0721