cmp

James A. Woods jaw at eos.UUCP
Wed Jun 22 07:43:17 AEST 1988


>From article <7993 at alice.UUCP>, by andrew at alice.UUCP:
> 
> 
> on most implementations, cmp has two getchars (or getc's) in the inner loop.
> we got a factor of five improvement by reading in blocks and using
> memcmp.

the 'cmp' on the cray two here is one of the rare unix commands which
is vectorized, though some poor soul had to code the loop as a fortran
subroutine (no vector C here).  it doesn't count lines (though nobody
cares, i don't believe this is inherently nonvectorizable).
you might think a regular byte-oriented 'cmp' would be i/o bound on
such a beast -- not true by a longshot; incidently this was one motivation
for my development of boyer/moore/gosper 'egrep' two years back.



More information about the Comp.unix.wizards mailing list