Skip to content

Commit 0ee3c7e

Browse files
committed
DPL: enable prefetching only for branches with one basket
1 parent 0b01409 commit 0ee3c7e

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

Framework/Core/src/TableTreeHelpers.cxx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -549,12 +549,25 @@ void TreeToTable::addAllColumns(TTree* tree, std::vector<std::string>&& names)
549549
}
550550
// Was affected by https://github.com/root-project/root/issues/8962
551551
// Re-enabling this seems to cut the number of IOPS in half
552-
tree->SetCacheSize(25000000);
553-
tree->SetClusterPrefetch(true);
552+
bool hasMultibasket = false;
553+
// Unfortunately ROOT 6-32-06 is still buggy. Adding a branch to
554+
// the cache only if the number of baskets allows it.
554555
for (auto& reader : mBranchReaders) {
555-
tree->AddBranchToCache(reader->branch());
556+
if (reader->branch()->GetListOfBaskets()->GetEntriesFast() != 1) {
557+
LOGP(warning, "Branch {} has more than one basket. Disabling prefetching for tree {}.", reader->branch()->GetName(), tree->GetName());
558+
hasMultibasket = true;
559+
break;
560+
}
561+
}
562+
if (hasMultibasket == false) {
563+
tree->SetCacheSize(25000000);
564+
tree->SetClusterPrefetch(true);
565+
for (auto& reader : mBranchReaders) {
566+
std::cout << "Branch added to cache " << reader->branch()->GetName() << std::endl;
567+
tree->AddBranchToCache(reader->branch());
568+
}
569+
tree->StopCacheLearningPhase();
556570
}
557-
tree->StopCacheLearningPhase();
558571
}
559572

560573
void TreeToTable::setLabel(const char* label)

0 commit comments

Comments
 (0)