diff --git a/tools/compile_mphf.py b/tools/compile_mphf.py index bd7e836..e7d13f2 100755 --- a/tools/compile_mphf.py +++ b/tools/compile_mphf.py @@ -170,7 +170,7 @@ def build_chd(keys_and_bytes, entry_count): displacements[bucket] = d value slot_to_entry_idx[slot] = index into keys_and_bytes, or -1 if empty """ - bucket_count = max(entry_count // 3, min(entry_count, 16)) + bucket_count = max(entry_count // 2, min(entry_count, 16)) # Assign keys to buckets buckets = defaultdict(list) @@ -271,7 +271,7 @@ def compile_mphf(entries, max_size=None, block_size=4096): unique_count = len(unique_translations) # Estimate size - bucket_count = max(entry_count // 3, min(entry_count, 16)) + bucket_count = max(entry_count // 2, min(entry_count, 16)) est_value_bits = max(1, math.ceil(math.log2(max(unique_count, 2)))) est_disp_bits = 16 # conservative est_disp_bytes = (bucket_count * est_disp_bits + 7) // 8 @@ -318,7 +318,7 @@ def compile_mphf(entries, max_size=None, block_size=4096): file=sys.stderr) entry_count = len(keys_and_bytes) - bucket_count = max(entry_count // 3, min(entry_count, 16)) + bucket_count = max(entry_count // 2, min(entry_count, 16)) print(f" Building CHD MPHF: {entry_count} entries, {bucket_count} buckets...", file=sys.stderr)