1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3
4source ./benchs/run_common.sh
5
6set -eufo pipefail
7
8header "Bloom filter map"
9for v in 2 4 8 16 40; do
10for t in 1 4 8 12 16; do
11for h in {1..10}; do
12subtitle "value_size: $v bytes, # threads: $t, # hashes: $h"
13	for e in 10000 50000 75000 100000 250000 500000 750000 1000000 2500000 5000000; do
14		printf "%'d entries -\n" $e
15		printf "\t"
16		summarize "Lookups, total operations: " \
17			"$($RUN_BENCH -p $t --nr_hash_funcs $h --nr_entries $e --value_size $v bloom-lookup)"
18		printf "\t"
19		summarize "Updates, total operations: " \
20			"$($RUN_BENCH -p $t --nr_hash_funcs $h --nr_entries $e --value_size $v bloom-update)"
21		printf "\t"
22		summarize_percentage "False positive rate: " \
23			"$($RUN_BENCH -p $t --nr_hash_funcs $h --nr_entries $e --value_size $v bloom-false-positive)"
24	done
25	printf "\n"
26done
27done
28done
29
30header "Hashmap without bloom filter vs. hashmap with bloom filter (throughput, 8 threads)"
31for v in 2 4 8 16 40; do
32for h in {1..10}; do
33subtitle "value_size: $v, # hashes: $h"
34	for e in 10000 50000 75000 100000 250000 500000 750000 1000000 2500000 5000000; do
35		printf "%'d entries -\n" $e
36		printf "\t"
37		summarize_total "Hashmap without bloom filter: " \
38			"$($RUN_BENCH --nr_hash_funcs $h --nr_entries $e --value_size $v -p 8 hashmap-without-bloom)"
39		printf "\t"
40		summarize_total "Hashmap with bloom filter: " \
41			"$($RUN_BENCH --nr_hash_funcs $h --nr_entries $e --value_size $v -p 8 hashmap-with-bloom)"
42	done
43	printf "\n"
44done
45done
46