Replies: 1 comment
-
There shouldn't be any scaling (i.e. O(n)) performance differences between calling That's where the optimization effort went: ensuring that there's no Python code in the O(n) loop, releasing the GIL when possible, minimizing the number of remote call-and-response, etc. No special effort was paid to minimizing the O(1) bookkeeping stuff. If you have a TTree with a very large number of branches and a small number of entries, then this "bookkeeping stuff" could become relevant, and maybe if you have a lot of these short, wide files, it would add up to human time (seconds or more). The " For instance, if this is the offending call: then we could speed it up like this: # on the HasBranches class...
_branches = None
@property
def branches(self):
"""
The list of :doc:`uproot.behaviors.TBranch.TBranch` directly under
this :doc:`uproot.behaviors.TTree.TTree` or
:doc:`uproot.behaviors.TBranch.TBranch` (i.e. not recursive).
"""
if self._branches is None:
# on this instance...
self._branches = self.member("fBranches")
return self._branches The " If, on the other hand, I'm guessing wrong about which member is being called so much, then that other member should be cached instead. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to understand what the overhead for reading a "flat" TTree (meaning no sub-branches and only fundamental types and arrays thereof) is when reading via
TTree.arrays
as compared to looping over the branches and callingTBranch.array
. This can be illustrated with the NanoAOD sample from the tests:The first noticeable thing when running a profiler is that there seem to be significantly more calls to
member
Why is that?
Beta Was this translation helpful? Give feedback.
All reactions