From bb3008d5a8f06a330039b3061feca07ce71eb478 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Sun, 29 Nov 2026 10:12:49 +0100 Subject: [PATCH] DPL: make the unsorted slicing cache update linear in the number of rows updateCacheEntryUnsorted checked whether each row's value was new with a std::find over the values seen so far, which is quadratic in the number of distinct values. groups is cleared at the start of the update, so a value is new exactly when its group is still empty: check that instead. The values are still sorted afterwards, so the cache content is unchanged. Measured on the inputs of Hyperloop test 814922 (cf-flow-sp, which declares PresliceUnsorted on mctracklabel::mcParticleId; up to 202,314 distinct values per DF): - the update alone, on all 83 DFs of one 5.4 GB AO2D (13.4 M rows): 219.5 s before, 0.81 s after, identical values and groups; - the full workflow on that file: 47m23s user CPU / 491 s wall before, 2m13s / 45 s after; AnalysisResults identical (1,202 TH1 bin by bin, 18 GFWWeights byte for byte). --- Framework/Core/src/ArrowTableSlicingCache.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Framework/Core/src/ArrowTableSlicingCache.cxx b/Framework/Core/src/ArrowTableSlicingCache.cxx index 7b96b7c0c0e85..f2138360eb9f5 100644 --- a/Framework/Core/src/ArrowTableSlicingCache.cxx +++ b/Framework/Core/src/ArrowTableSlicingCache.cxx @@ -190,12 +190,12 @@ arrow::Status ArrowTableSlicingCache::updateCacheEntryUnsorted(int pos, std::sha for (auto iElement = 0; iElement < chunk.length(); ++iElement) { auto v = chunk.Value(iElement); if (v >= 0) { - if (std::find(valuesUnsorted[pos].begin(), valuesUnsorted[pos].end(), v) == valuesUnsorted[pos].end()) { - valuesUnsorted[pos].push_back(v); - } if ((int)groups[pos].size() <= v) { groups[pos].resize(v + 1); } + if ((groups[pos])[v].empty()) { + valuesUnsorted[pos].push_back(v); + } (groups[pos])[v].push_back(row); } ++row;