java-topology/defects/root-cern-0001/patch/root-cern-0001-treecache-potentialvetoes.patch

43 lines
1.8 KiB
Diff

# UNDF: UNDF-2026-000001152
# UNDF:
--- a/tree/tree/src/TTreeCache.cxx
+++ b/tree/tree/src/TTreeCache.cxx
@@ -299,6 +299,7 @@
#include "TRegexp.h"
#include "TLeaf.h"
#include "TFriendElement.h"
#include "TFile.h"
#include "TMath.h"
#include "TBranchCacheInfo.h"
#include "TVirtualPerfStats.h"
#include <climits>
+#include <unordered_set>
#include <memory>
@@ -1378,7 +1378,7 @@
Int_t nReachedEnd = 0;
Int_t nSkipped = 0;
auto oldnReadPrefRequest = nReadPrefRequest;
- std::vector<Int_t> potentialVetoes;
+ std::unordered_set<Int_t> potentialVetoes;
if (showMore || gDebug > 7)
Info("CollectBaskets", "Called with pass=%d narrow=%d maxCollectEntry=%lld", pass, narrow, maxCollectEntry);
@@ -1395,7 +1395,7 @@
potentialVetoes.clear();
if (pass == kStart && !cursor[i].fLoadedOnce && resetBranchInfo) {
// First check if we have any cluster that is currently in the
// cache but was not used and would be reloaded in the next
// cluster.
- b->fCacheInfo.GetUnused(potentialVetoes);
+ { std::vector<Int_t> tmp; b->fCacheInfo.GetUnused(tmp); for (auto v : tmp) potentialVetoes.insert(v); }
if (showMore || gDebug > 7) {
TString vetolist;
for(auto v : potentialVetoes) {
@@ -1508,7 +1508,7 @@
- if (std::find(std::begin(potentialVetoes), std::end(potentialVetoes), j) != std::end(potentialVetoes)) {
+ if (potentialVetoes.count(j)) {
// This basket was in the previous cache/cluster and was not used,
// let's not read it again. I.e. we bet that it will continue to not
// be used. At worst it will be used and thus read by itself.