[sldev] Cache speed experiment & results...

Argent Stonecutter secret.argent at gmail.com
Wed Jun 4 19:24:30 PDT 2008


On 2008-06-04, at 15:27, Robin Cornelius wrote:
> Robin Cornelius wrote:
>> Well for the 1st digit there is a 1/16 chance of a hit, for 2  
>> digits its
>> 1/256 chance for the Nth digit its a 1/(16^N) chance, so for your
>> specific question its 1/4294967296 (1 in about 4.2 billion).
>

> Oh assuming a perfect random (white) distribution of cause, any error,
> grouping, bais or offset throws this to the dogs.

Of course the next question is... what's the consequences of a false  
positive?

If it's "you compare the whole thing", it doesn't matter.

A common trick in C is something like this:

if(*s == *t && strcmp(s, t)==0) { ... }

If *s and *t are uniformly distributed, you save 255/256 calls. If  
they're both letters, you save 25 out of 26. If that's in a tight  
loop, it's worth doing.



More information about the SLDev mailing list