in particular you should not be able to execute f->GetCacheRead()->SetEnablePrefetching(false) .
This is what I have in my simple example (attached).
Could you produce an example where this does not happen?
#include <string>
#include <iostream>
#include "TTree.h"
#include "TFile.h"
#include "TFileCacheRead.h"
#include "TTreeCache.h"
int main(int argc, char **argv) {
auto f = TFile::Open(argv[1], "read");
auto t = (TTree*)f->Get("tree");
const Long_t BRANCHES= 100;
Double_t v[BRANCHES] = {0};
for (int i = 0; i < BRANCHES; i++) {
auto n = TString::Format("Scalar_%d", i);
t->SetBranchAddress(n, &v[i]);
}
Long_t entries = t->GetEntries();
std::cout << "entries= " << entries << "\n";
if (argc > 2) {
std::cout <<"set-cache: " << argv[2] << "\n";
t->SetCacheSize(atoi(argv[2]));
}
auto fc = f->GetCacheRead();
if (fc != NULL) {
std::cout << "disable pre-fetching...\n";
fc->SetEnablePrefetching(false);
}
std::cout << "cache size=" << t->GetCacheSize() << "\n";
Double_t sum = 0;
for ( Long_t i = 0; i < entries; i++ ) {
t->GetEntry(i);
sum += v[0];
}
std::cout << "sum= " << sum << "\n";
printf("Reading %lld bytes in %d transactions\n",f->GetBytesRead(), f->GetReadCalls());
return 0;
}
what I am trying to do is assessing what would be the I/O performances of ROOT w/o TTreeCache.
I was under the assumption that even for local files, TTreeCache was improving I/O.
there isn’t real dramatical effect.
while I vaguely recall from my early ATLAS days studies that showed real gains (but perhaps I am confusing with studies with non-local files…)