pack-bitmap-write: better reuse bitmaps
authorDerrick Stolee <dstolee@microsoft.com>
Tue, 8 Dec 2020 22:05:30 +0000 (17:05 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 8 Dec 2020 22:49:07 +0000 (14:49 -0800)
commitf077b0a9860f383a3cd0ce3a0e2a11ff2f27fc65
treecc2b355638779725610bd828ace19472d1826303
parent45f4eeb2919e2c802a6c1f64a2b1c299f7434938
pack-bitmap-write: better reuse bitmaps

If the old bitmap file contains a bitmap for a given commit, then that
commit does not need help from intermediate commits in its history to
compute its final bitmap. Eject that commit from the walk and insert it
into a separate list of reusable commits that are eventually stored in
the list of commits for computing bitmaps.

This helps the repeat bitmap computation task, even if the selected
commits shift drastically. This helps when a previously-bitmapped commit
exists in the first-parent history of a newly-selected commit. Since we
stop the walk at these commits and we use a first-parent walk, it is
harder to walk "around" these bitmapped commits. It's not impossible,
but we can greatly reduce the computation time for many selected
commits.

             |   runtime (sec)    |   peak heap (GB)   |
             |                    |                    |
             |   from  |   with   |   from  |   with   |
             | scratch | existing | scratch | existing |
  -----------+---------+----------+---------+-----------
  last patch |  88.478 |   53.218 |   2.157 |    2.224 |
  this patch |  86.681 |   16.164 |   2.157 |    2.222 |

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pack-bitmap-write.c