file check

Nicholas Clark nick at ccl4.org
Tue Jul 15 12:09:24 BST 2008


On Tue, Jul 15, 2008 at 12:01:44PM +0100, Peter Corlett wrote:
> On Tue, Jul 15, 2008 at 11:38:24AM +0100, Nigel Rantor wrote:

> > Otherwise use cmp, as others have said using a hash is slower than cmp,
> > and doesn't tell you if they're the same, only if they're different.
> 
> Hashing will however work out quicker for the more typical problem of having
> a bunch of files and wanting to know if there are any duplicates.

Very true. Although also in that case checking that the length of the files is
identical is an even faster first step, particularly if you can make the
generation of the hash lazy and defer it until it's first needed.

Nicholas Clark


More information about the london.pm mailing list