Re: [PATCH 1/1] Bypass expensive content comparsion during rename detection.
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Dec 14, 2006, 11:18 UTC
- Message-ID
- <Pine.LNX.4.63.0612141214440.3635@wbgn013.biozentrum.uni-wuerzburg.de>
- In-Reply-To
- <20061214110858.GE1747@spearce.org>
Hi,
On Thu, 14 Dec 2006, Shawn Pearce wrote:
Show 6 quoted lines
> My first version of the patch had the hash comparsion right after we > called diff_populate_filespec to get the size data. But then I realized > that very often the sizes will be different and the src->size != > dst->size comparsion will tend to be true most of the time, thus saving > us a (relatively) expensive hash comparsion, which we know must fail > anyway if the sizes differed.
Ah! I misunderstood. Since the call to diff_populate_filespec was not visible in the hunk, I erroneously assumed that you meant to _check_ the sizes before checking the hashes.
But your explanation makes lots of sense to me. May I request a short comment above the new code, like "let diff_populate_filespec() do its thing since we need the filesize later on anyway, and having that, do the cheaper filesize check before the more expensive hashcmp()"?
Ciao, Dscho