Newsgroups: comp.arch Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: Understanding variations in Dhrystone performance Message-ID: <1989May16.172354.1417@utzoo.uucp> Organization: U of Toronto Zoology References: <474@estevax.UUCP> <1989May15.173631.3029@utzoo.uucp> Date: Tue, 16 May 89 17:23:54 GMT In article <1989May15.173631.3029@utzoo.uucp> I wrote: > (((x & ~0x80808080) - 0x01010101) & 0x80808080) > >The result is nonzero if, and only if, there was a NUL byte in x... Oops, my mistake, it does get a false alarm on an 0x80. So you do end up needing a false-alarm filter. There are ways around this, but they add their own overheads. Nevertheless, alignment permitting, using a fast filter like this is a considerable win if you're scanning big chunks of text. Now, how worthwhile *any* of this is for typical C strings is a different question -- it's hard to amortize any significant setup overhead over the short strings typically found in real code. -- Subversion, n: a superset | Henry Spencer at U of Toronto Zoology of a subset. --J.J. Horning | uunet!attcan!utzoo!henry henry@zoo.toronto.edu