[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: poor m4 hash performance
From: |
Eric Blake |
Subject: |
Re: poor m4 hash performance |
Date: |
Mon, 05 Jun 2006 06:20:26 -0600 |
User-agent: |
Thunderbird 1.5.0.4 (Windows/20060516) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Paul Eggert on 6/4/2006 10:24 PM:
> Eric Blake <address@hidden> writes:
>
>> right now, both the 1.4 branch and head use an algorithm borrowed from emacs:
>
> That algorithm could be improved. M4 should do all its hash
> computation using size_t, not a mixture of int and size_t. And it
> shouldn't slow itself down to do case-folding, since M4 is
> case-sensitive. And it shouldn't assume that int is 32 bits wide.
Agreed (I had already noticed that using a signed hash was wrong, but had
not picked up on the case-folding). I will go ahead and commit your patch.
> 2006-06-04 Paul Eggert <address@hidden>
>
> * src/m4.h (hash_table_size): Now size_t instead of int.
> * src/m4.c (hash_table_size): Likewise.
> (main): Adjust to this; use atol rather than atoi.
> * src/symtab.c: Include <limits.h>, for CHAR_BIT.
> (symtab_init, lookup_symbol, hack_all_symbols):
> Use size_t for sizes and indexes, not int.
> (hash): Likewise. Don't case-fold in the hash function.
> Shift by 7, not 3, for consistency with gnulib/lib/hash.c.
> Don't assume hash word is 32 bits.
>
- --
Life is short - so eat dessert first!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEhCGK84KuGfSFAYARAg1hAJ4+g+oo7u6RlHPxTNLHmryP6Qo2dwCgqIjS
SLdMy9iasNTEWlXeBOnCpdw=
=e67k
-----END PGP SIGNATURE-----