]> git.ipfire.org Git - thirdparty/git.git/commit - diffcore-rename.c
diffcore-rename: simplify and accelerate register_rename_src()
authorElijah Newren <newren@gmail.com>
Fri, 11 Dec 2020 09:08:46 +0000 (09:08 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 14 Dec 2020 17:34:50 +0000 (09:34 -0800)
commitb970b4ef62432980bf106c2f0970c25ae0de5cce
treeccfc74b0c744ffb3ceaa240a05c17bab0ee8fce4
parentac14de13b228285b798ed805812fe20d1bc55eb2
diffcore-rename: simplify and accelerate register_rename_src()

register_rename_src() took pains to create an array in rename_src which
was sorted by pathname of the contained diff_filepair.  The sorting was
entirely unnecessary since callers pass filepairs to us in sorted
order.  We can simply append to the end of the rename_src array,
speeding up diffcore_rename() setup time.

Also, note that I dropped the return type on the function since it was
unconditionally discarded anyway.

This patch is being submitted in a different order than its original
development, but in a large rebase of many commits with lots of renames
and with several optimizations to inexact rename detection,
diffcore_rename() setup time was a sizeable chunk of overall runtime.
This patch dropped execution time of rebasing 35 commits with lots of
renames by 2% overall.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diffcore-rename.c