diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-06-26 13:20:54 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-06-26 13:27:50 -0400 |
commit | ebbb0348dc3ad57f6be8208a90f3c2fd9fe2cbf7 (patch) | |
tree | bb64d4cdd2913bc17f8f559c360824caa90e33a8 /src/test/bench.c | |
parent | bf89278c799e718a3b6c1ea139a6069db054ac09 (diff) | |
download | tor-ebbb0348dc3ad57f6be8208a90f3c2fd9fe2cbf7.tar.gz tor-ebbb0348dc3ad57f6be8208a90f3c2fd9fe2cbf7.zip |
Finish renaming digestset_contains to digestset_probably_contains
Since bloom filters are probabilistic, it's nice to make it clear
that the "contains" operation can have false positives.
Diffstat (limited to 'src/test/bench.c')
-rw-r--r-- | src/test/bench.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/test/bench.c b/src/test/bench.c index aa4af703f5..6653f4942f 100644 --- a/src/test/bench.c +++ b/src/test/bench.c @@ -404,18 +404,20 @@ bench_dmap(void) NANOCOUNT(pt3, pt4, iters*elts)); for (i = 0; i < iters; ++i) { - SMARTLIST_FOREACH(sl, const char *, cp, n += digestset_contains(ds, cp)); - SMARTLIST_FOREACH(sl2, const char *, cp, n += digestset_contains(ds, cp)); + SMARTLIST_FOREACH(sl, const char *, cp, + n += digestset_probably_contains(ds, cp)); + SMARTLIST_FOREACH(sl2, const char *, cp, + n += digestset_probably_contains(ds, cp)); } end = perftime(); - printf("digestset_contains: %.2f ns per element.\n", + printf("digestset_probably_contains: %.2f ns per element.\n", NANOCOUNT(pt4, end, iters*elts*2)); /* We need to use this, or else the whole loop gets optimized out. */ printf("Hits == %d\n", n); for (i = 0; i < fpostests; ++i) { crypto_rand(d, 20); - if (digestset_contains(ds, d)) ++fp; + if (digestset_probably_contains(ds, d)) ++fp; } printf("False positive rate on digestset: %.2f%%\n", (fp/(double)fpostests)*100); |