[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Yep, already got an appointment (on ppf_DirTree)
Bjarke Hammersholt Roune wrote:
>>strlen() is therefore not that effecient a hash function to use. However,
>>isn't there some way in which we can hash the filename into something that
>>has a larger chance of being unique? Well, we could do something like ORing
>>each byte of the string together. That would certainly be a very good hash
>>value, as it would change with any change in the filename, so pix001.gif
>and
>>pix002.gif would hash to different values. Using suchs a hash algorithm, we
>>would have a pretty good chance of having the hash values spread out to
>>statistically fill the entire 0-255 range of a byte, this only making each
>>node larger by 1 byte. For each 1024 files, that would 1 kb.
>>
>ORing all the bytes together would of course be completely pointless, as it
>would just give you a value of 0xFF or something very close. What I mean
>was, of course, XOR - eXclusive OR.
Well, but then you have to do the same processing on the string you compare
with (the one you're searching) - and with that you lose much of the speed
benefit (xoring all bytes in a string should be slower than a worst-case
comparison - and you don't have many comparisons).
That could give some minor benefit for very large directories, but else ...
Christian
--
Drive A: not responding...Formatting C: instead