This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Patch] Add two tests of hash function quality
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: Matt Austern <austern at gmail dot com>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Fri, 24 Sep 2010 23:42:40 +0200
- Subject: Re: [Patch] Add two tests of hash function quality
- References: <AANLkTikrbe-b-GTau+3oTpjXLpXCepjDsMNGD4O64Bih@mail.gmail.com>
Hi Matt,
> This patch adds two very different tests to verify that we have a good
> hash function. This is a very large and well studied area, and in principle
> we could have many more tests of this sort, but a least these ones are
> a start.
>
> One test is very simple to describe: it hashes a set of strings to a set
> of buckets, and uses chi^2 to verify that the distribution is uniform.
> The other is slightly more complicated, but essentially it verifies that
> every bit of the input string affects every bit of the output hash code.
>
I think the patch is almost ready to go in. Thanks. I have only a
concern, that these tests may take a little too much to run (*) and
timeout on simulators: can you imagine a sensible way to use one of
those DejaGnu directives like (we have already quite a few examples in
the testsuite):
// { dg-options "-DMAX_ITERATIONS=5" { target simulator } }
Thanks again,
Paolo.
(*) In particular quality.cc, ~17 secs of real time on my rather new i7
machine. Should be easier to tweak, since doesn't use a statistical test...