]> git.ipfire.org Git - thirdparty/git.git/commit
xdiff: remove "line_hash" field from xrecord_t
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Mon, 26 Jan 2026 10:48:51 +0000 (10:48 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Jan 2026 16:38:29 +0000 (08:38 -0800)
commitc27afcbfd0f440f410758432e2fe11a16fb2b360
tree1ca40888eaa253bdb49f468ec119206b51d58967
parent22ce0cb6397d3d15c21c217696f262c4b8eb44b3
xdiff: remove "line_hash" field from xrecord_t

Prior to commit 6a26019c81 (xdiff: split xrecord_t.ha into line_hash
and minimal_perfect_hash, 2025-11-18) the "ha" field of xrecord_t
initially held the "line_hash" value and once the line had been
interned that field was updated to hold the "minimal_perfect_hash". The
"line_hash" is only used to intern the line so there is no point in
storing it after all the input lines have been interned.

Removing the "line_hash" field from xrecord_t and storing it in
xdlclass_t where it is actually used makes it clearer that it is a
temporary value and it should not be used once we're calculated the
"minimal_perfect_hash". This also reduces the size of xrecord_t by 25%
on 64-bit platforms and 40% on 32-bit platforms. While the struct is
small we create one instance per input line so any saving is welcome.

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