Skip to content

Improve readability of ClusterFinder, add ClusterFinder benchmark#307

Open
lrlunin wants to merge 6 commits into
mainfrom
find-clusters-refactor
Open

Improve readability of ClusterFinder, add ClusterFinder benchmark#307
lrlunin wants to merge 6 commits into
mainfrom
find-clusters-refactor

Conversation

@lrlunin

@lrlunin lrlunin commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

In the following PR I slightly changed the ClusterFinder:

  • Simplified if-else cases for better readability.
  • Move cluster size template arguments to the constexpr fields.
  • Add additional update_pedestals flag to skip pedestal update if it is not needed.

Also added a benchmark for ClusterFinder benchmark. The test data is defined via environmental variables. Also removed duplicates of BENCHMARK_MAIN in favor of single benchmark::benchmark_main target for benchmarks.

@lrlunin lrlunin marked this pull request as ready for review May 5, 2026 07:07

@AliceMazzoleni99 AliceMazzoleni99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. The ClusterFinder is much more readable now. Added some minor comments.

Comment thread benchmarks/CMakeLists.txt
set_target_properties(fit_benchmark PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_BINARY_DIR})

add_executable(clusterfinder_benchmark clusterfinder_benchmark.cpp)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can automatically filter for a specific benchmark using ./run_benchmark --benchmark_filter="benchmarkname". So no need to add a seperate executable.

Comment thread benchmarks/CMakeLists.txt
aare_compiler_flags)
target_link_libraries(
benchmarks PRIVATE benchmark::benchmark benchmark::benchmark_main aare_core
aare_compiler_flags)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice much cleaner than always moving BENCHMARK_MAIN()

#include <random>
#include <string>
#include <vector>
namespace {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be namespace aare?

static_cast<int64_t>(n_test_frames));
state.SetLabel(label);
}
// Wrapper for the old function

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a benchmark fixture is better. e.g. BENCHMARK_F. You can have a setup function in the BenchmarkData class

}
void find_clusters(NDView<FRAME_TYPE, 2> frame, uint64_t frame_number = 0) {
void find_clusters(NDView<FRAME_TYPE, 2> frame, uint64_t frame_number = 0,
bool update_pedestal = true) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmh do you want to store update_pedestal or do you want it as a member variable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants