cmp efficiency

Nick Crossley nick at ccicpg.UUCP
Thu Jun 23 11:08:21 AEST 1988


> While we're on the subject of efficiency, cmp is coded wrong. It should
> first stat the two files to be compared. If the character count is different,
> so are the files. And files tend to be different more often than the same.

First, files given to cmp are quite likely to be the same, in my experience.

Second, if the files are not the same size, cmp will tell you if they have the
same contents up to the length of the shorter (cmp will say 'EOF on file 1/2').
I find this useful in some contexts, and would not want cmp just to give up
if the sizes differed.
-- 

<<< standard disclaimers >>>
Nick Crossley, CCI, 9801 Muirlands, Irvine, CA 92718-2521, USA
Tel. (714) 458-7282,  uucp: ...!uunet!ccicpg!nick



More information about the Comp.unix.wizards mailing list