]> git.ipfire.org Git - thirdparty/git.git/commit
xdiff: reduce size of action arrays
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Mon, 4 May 2026 14:06:18 +0000 (15:06 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 5 May 2026 07:20:05 +0000 (16:20 +0900)
commita81411253323208e1e8d3591247c27fefa8a2045
treebdb293b1d13be4bfb08e53bd6f070536a6332191
parentbfd057b2dd5226f0eedbf1ad47506f8ed33a715a
xdiff: reduce size of action arrays

When the myers algorithm is selected the input files are pre-processed
to remove any common prefix and suffix. Then any lines that appear
only in one side of the diff are marked as changed and frequently
occurring lines are marked as changed if they are adjacent to a
changed line. This step requires a couple of temporary arrays. As as
the common prefix and suffix have already been removed, the arrays
only need to be big enough to hold the lines between them, not the
whole file. Reduce the size of the arrays and adjust the loops that
use them accordingly while taking care to keep indexing the arrays
in xdfile_t with absolute line numbers.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
xdiff/xprepare.c