I’m just a user, so hopefully somebody real will respond, but…
When you use a function, it doesn’t know which branches it needs so it loads the whole object. If you just draw one (or N) member data, it only loads those pieces. So, as far as I know, we’re stuck…
Cheers,
Charles
p.s. It would be kind of cool if we could tell root/rootcint/reflex this member function only uses these data…
Inmytree->Draw("myFunc(treevar)") we use CINT to execute the function. Relatively speaking this is a slow operation and explain the factor 100. To regain the performance, we recommand that the syntaxmytree->Draw("myscript.C+");[code]with myscript.h being [code]#include "myFunc.h" and myscript.C being double myscript() { return myFunc(treevar); }. (See TTree::Draw documentation for more details).
cannot be the complete answer to this performance hit, as you can see, if you run my testcase in the interpreted mode. Calling 200000 the testcase function in CINT mode takes not more than 0.3 seconds on my PC, while calling the function in question via TTree::Draw takes 10 second for 200000 calls.
Because of this I am more than glad to see performance improvements in the TTree::Draw implementation. Using TTree::Draw with a script file to speed up the Draw method helps to regain the performance, but requires to handle three source code files instead of only one. This is no issue, if you are working on a ROOT project with several source files, but for small “quick-and-dirty”-scripts this is quite annoying.