Funny behaviour of bm under V7

Ron Sheen ron at unrvax.UUCP
Fri Aug 23 03:27:49 AEST 1985


We also found bm to be slow under 2.9.  The problem is that bm
reads from its input file into a buffer at possibly and odd
address and possibly (usually) not a multiple of 512 bytes.

The following changes brought bm's performance more in line 
with what was expected:

In Execute.c:
line 42 reads from the input file into Buffer, change:
read(TextFile,Buffer + ResSize + NRead, NWanted);
to:
read(TextFile,Buffer + ResSize + NRead, (NWanted>>9)<<9);

In MoveResidue.c:
lines 29-31 move the residue in Buffer to the beginning of buffer.
	t=Buffer; f=Residue;
	for(i=ResSize;i;i--)
		*t++ = *f++;
add the following to insure the next read occurs on a word boundary:
	/* check if next word is at an odd address */
	if((int) (t - Buffer) & 1) {
		*t = '\0';
		ResSize++;
		}

				Ron Sheen
				seismo!unr70!ron



More information about the Comp.unix.wizards mailing list