Skip to content

Commit

Permalink
perf: desperate attempts to unlink output arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
jpivarski committed Sep 25, 2024
1 parent f36f39c commit 6c80227
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/uproot/behaviors/TBranch.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,14 @@ def iterate(
arrays, report = item
arrays = library.global_index(arrays, global_offset)
report = report.to_global(global_offset)
yield arrays, report
popper = [arrays]
del arrays
yield popper.pop(), report

else:
arrays = library.global_index(item, global_offset)
yield arrays
popper = [library.global_index(item, global_offset)]
yield popper.pop()

except uproot.exceptions.KeyInFileError:
if allow_missing:
continue
Expand Down Expand Up @@ -1111,6 +1115,9 @@ def iterate(
ak_add_doc,
)

# no longer needed; save memory
del output

next_baskets = {}
for branch, basket_num, basket in ranges_or_baskets:
basket_entry_start, basket_entry_stop = basket.entry_start_stop
Expand All @@ -1119,10 +1126,14 @@ def iterate(

previous_baskets = next_baskets

# no longer needed; save memory
popper = [out]
del out

if report:
yield out, Report(self, sub_entry_start, sub_entry_stop)
yield popper.pop(), Report(self, sub_entry_start, sub_entry_stop)
else:
yield out
yield popper.pop()

def keys(
self,
Expand Down

0 comments on commit 6c80227

Please sign in to comment.