Enable async prefetching per file / per tree?

Hi all,

I know that one can enable asynchronous file prefetching in ROOT with
gEnv->SetValue("TFile.AsyncPrefetching", 1).

Is it possible to enable asynchronous prefetching only when reading a specific file or only
when reading a particular tree?

Thanks!

It seems it is a global setting only. @pcanal might tell you more.

Hi @couet, @pcanal

looking at the code it seems I could add a field fEnableAsyncPrefetch to TTree and a setter method SetCacheAsyncPrefetching(Bool_t), which could be called by the user before they start reading tree entries.

Then, whenever the TTree creates a new TTreeCache, the TTree will communicate to the cache the
TTree:: fEnableAsyncPrefetch variable (through TTreeCache's constructor or TFileCacheRead->SetEnablePrefetching().

This will make it easy to enable async prefetching per TTree and per TFile (maybe TFile will need a similar member variable).

A use case for this feature would be when a program reads multiple ROOT files and async prefetching would be advantageous for some the files only.

Shall I give it a go with a pull request?

Thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

Doesn’t

tree->GetReadCache(tree->GetCurrentFile(), true) -> SetEnablePrefetching();

already accomplish what you need?

Cheers,
Philippe.