Skip to content

Commit

Permalink
prefetch
Browse files Browse the repository at this point in the history
Signed-off-by: zombee0 <ewang2027@gmail.com>
  • Loading branch information
zombee0 committed Jul 1, 2024
1 parent 6afe214 commit a01f4f8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions be/src/exec/aggregate/agg_hash_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,14 @@ struct AggHashSetOfSerializedKeyFixedSize : public AggHashSet<HashSet, AggHashSe
hashes[i] = this->hash_set.hash_function()(key[i]);
}

// This is just an empirical value based on benchmark, and you can tweak it if more proper value is found.
static constexpr size_t AGG_HASH_SET_DEFAULT_PREFETCH_DIST = 16;
size_t __prefetch_index = AGG_HASH_SET_DEFAULT_PREFETCH_DIST;

for (size_t i = 0; i < chunk_size; ++i) {
if (__prefetch_index < chunk_size) {
this->hash_set.prefetch_hash(hashes[__prefetch_index++]);
}
if constexpr (compute_and_allocate) {
this->hash_set.insert_with_hash(hashes[i], key[i]);
} else {
Expand Down

0 comments on commit a01f4f8

Please sign in to comment.