Skip to content

Commit

Permalink
latest version that's being performance tested
Browse files Browse the repository at this point in the history
  • Loading branch information
Gillgamesh committed Mar 11, 2024
1 parent 6b82f64 commit 7a3b793
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
set(BUILD_BENCH TRUE)

# Make the default build type Release. If user or another
# project sets a different value than use that
Expand Down
2 changes: 1 addition & 1 deletion include/bucket.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ inline col_hash_t Bucket_Boruvka::get_index_depth(const vec_t update_idx, const
const vec_hash_t max_depth) {
col_hash_t depth_hash = col_hash(&update_idx, sizeof(vec_t), seed_and_col);
depth_hash |= (1ull << max_depth); // assert not > max_depth by ORing
return __builtin_ctzll(depth_hash) >> 1;
return __builtin_ctzll(depth_hash);
}

inline vec_hash_t Bucket_Boruvka::get_index_hash(const vec_t update_idx, const long sketch_seed) {
Expand Down
22 changes: 11 additions & 11 deletions src/sketch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,19 @@ SketchSample Sketch::fast_sample() {

Bucket* current_column = buckets + ((idx * cols_per_sample + col) * bkt_per_col);

// TODO - currently this is only set up for a single column. Should be pretty minimal changes
for (size_t idx=0; idx < 5; idx++) {
for (size_t idx=0; idx < 3; idx++) {
if (Bucket_Boruvka::is_good(current_column[idx], checksum_seed()))
return {current_column[idx].alpha, GOOD};
}
size_t lo=1, hi=bkt_per_col;

while (lo + window_size < bkt_per_col && !(
!Bucket_Boruvka::is_zero(current_column[lo]) && Bucket_Boruvka::is_zero(current_column[lo+window_size])
)) {
lo *= 2;
}
hi = std::min(lo+2*window_size, hi);
lo /= 2;
// while (lo + window_size < bkt_per_col && !(
// !Bucket_Boruvka::is_zero(current_column[lo]) && Bucket_Boruvka::is_zero(current_column[lo+window_size])
// )) {
// lo *= 2;
// }
// hi = std::min(lo+2*window_size, hi);
// lo /= 2;
size_t midpt = (lo+hi)/2;
do {
if (!Bucket_Boruvka::is_zero(current_column[midpt]) && Bucket_Boruvka::is_zero(current_column[midpt+window_size])) {
Expand All @@ -144,10 +143,11 @@ SketchSample Sketch::fast_sample() {
lo = midpt;
}
midpt = (lo+hi)/2;
} while (hi-lo >= 3*window_size);
} while (hi-lo >= 2*window_size);
lo = std::max((size_t) 0, lo);
hi = std::min(hi, bkt_per_col);
for (size_t i=lo; i < hi; i++) {
// for (size_t i=lo; i < hi; i++) {
for (size_t i=hi-1; i <= lo; i--) {
if (Bucket_Boruvka::is_good(current_column[i], checksum_seed()))
return {current_column[i].alpha, GOOD};
}
Expand Down
2 changes: 1 addition & 1 deletion tools/benchmark/graphcc_bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ BENCHMARK(BM_Sketch_Update)->RangeMultiplier(4)->Ranges({{KB << 4, MB << 4}});

// Benchmark the speed of querying sketches
static void BM_Sketch_Query(benchmark::State& state) {
constexpr size_t vec_size = KB << 5;
constexpr size_t vec_size = KB << 22;
constexpr size_t num_sketches = 100;
double density = ((double)state.range(0)) / 100;

Expand Down

0 comments on commit 7a3b793

Please sign in to comment.