diff --git a/include/aare/hist/PixelHistogram.hpp b/include/aare/hist/PixelHistogram.hpp index f4e0812..c5f7b79 100644 --- a/include/aare/hist/PixelHistogram.hpp +++ b/include/aare/hist/PixelHistogram.hpp @@ -49,6 +49,8 @@ class PixelHistogram { // Async producer/consumer pipeline. SPSC queue feeds the coordinator // thread, which fans each image out to the worker pool one at a time. + // TODO: batch processing? + // TODO: FIFO to avoid allocations? std::unique_ptr async_queue_; std::thread coordinator_; std::atomic stop_coordinator_{false}; @@ -74,7 +76,7 @@ class PixelHistogram { // coordinator thread, and returns. Blocks the caller only if the queue // is full (single-producer, single-consumer queue with a sleep-poll // backpressure loop, matching the convention in ClusterFinderMT). - void fill_async(NDArray image); + void fill_async(NDArray &&image); // Wait for all queued async fills to complete. Cheap when the queue // is already drained. @@ -289,7 +291,7 @@ void PixelHistogram::dispatch( template void PixelHistogram::fill_async( - NDArray image) { + NDArray &&image) { if (image.shape(0) != rows_ || image.shape(1) != cols_) { throw std::invalid_argument( "PixelHistogram image shape does not match constructor shape"); diff --git a/python/src/bind_PixelHistogram.hpp b/python/src/bind_PixelHistogram.hpp index 0e61f52..d205bce 100644 --- a/python/src/bind_PixelHistogram.hpp +++ b/python/src/bind_PixelHistogram.hpp @@ -40,7 +40,7 @@ void define_pixel_histogram_binding(py::module &m, const char *class_name, asynchronous filling before fill_async() applies backpressure on the caller (default: 16) )", - py::arg("rows"), py::arg("cols"), py::arg("n_bins"), + py::kw_only(), py::arg("rows"), py::arg("cols"), py::arg("n_bins"), py::arg("xmin"), py::arg("xmax"), py::arg("n_threads") = 1, py::arg("max_pending") = std::size_t{16})