[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cyrus-devel
Subject:    Heads up - new dependency gperf
From:       Bron Gondwana <brong () fastmail ! fm>
Date:       2010-11-18 22:10:26
Message-ID: 20101118221026.GB8974 () brong ! net
[Download RAW message or body]

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.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic