Re: [PATCH] Optimize rename detection for a huge diff
- From
David Kastrup <dak@gnu.org>
- Date
- Feb 13, 2008, 10:19 UTC
- Message-ID
- <864pcd9n0e.fsf@lola.quinscape.zz>
- In-Reply-To
- <7vodalqj0s.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 7 quoted lines
> The first hunk is about shrinking the diff_score structure; > before the patch, it was O(NxM) where N and M are number of > rename source and destination candidates, but after the patch it > is now O(M), so this shrinkage should not matter, but score is > capped to MAX_SCORE (60000) and name_score is actually 0 or 1. > We cannot make it 1-bit unsigned bitfield as there is a qsort > comparison callback that does (b->name_score - a->name_score).
Hm? Can't that be changed into
(b->name_score > a->name_score ? 1 : b->name_score < a->name_score ? -1 : 0)
or something? Or perhaps just
((int)b->name_score - (int)a->name_score)
or so?
It sounds like a factor 2 is in question here, and that would seem like an easy fix?
-- David Kastrup