Heads up - new dependency gperf
Bron Gondwana
brong at fastmail.fm
Thu Nov 18 17:10:26 EST 2010
Hi everyone,
Greg's work has added a new dependency, gperf, to the build process
on development code from git.
Gperf builds a "perfect hash" for a defined set of strings. It's the
same technology that lex and yacc use for fast parsing.
So far gperf is being used in message.c to replace the nested:
if (str[0] == 'R') {
if (!strcmp(str, "Received")) { ... }
if (!strcmp(str, "References")) { ... }
}
elsif (str[0] == 'X') {
...
}
mess, with a single hash function followed by a switch statement.
The plan is to extend this to all the cases where we have half-baked
hashing with two levels of comparison - it's faster to execute and
easier to read :)
We've made sure that the generated files are created by "make dist",
so gperf is not required to install from a tarball - just to install
from git.
You can read more about gperf here:
http://www.gnu.org/software/gperf/
Regards,
Bron.
More information about the Cyrus-devel
mailing list