On Wed, Aug 04, 2010 at 05:01:56AM +0100, David Tweed wrote: > It's also worth remembering that K & R was written at a time many > decades ago when performance aspects of computer architecture were a > lot, lot simpler. Apparently they have > > #define HASHSIZE 101 > > which given that there's no really efficient way of computing % for > arbitrary numbers is going to be quite slow (particularly if the > strings are short), which is why hashes for modern machines use table > sizes that avoid needing a mod. (There are other things that are slow > on modern architectures that modern hash functions avoid.) I'd use K&R > for the C syntax and some of the higher level ideas of programming, > but not try to understand good hashing technology from there. I wasn't trying to understand good hashing technology, I was in the dark why the number 31 was being used. I understand now, though.
pgpxVO6CScZd2.pgp
Description: PGP signature