1

我有这个根文件,可以在 Google 驱动器的这个链接上找到,当我使用并行处理将它转换为根 3 中的数组时,它花费的时间和内存更少。我使用的代码类似于

from concurrent.futures import ThreadPoolExecutor
executor = ThreadPoolExecutor(8)

branches = pd.DataFrame.from_dict(uproot.open(''+file_with_path+'')[''+tree_name+''].arrays(namedecode='utf-8', executor = executor))

但是现在它消耗了我在根 4 中的所有内存,可能是我做得不对。你能看一下吗?而且也没有以前那么快了。

from concurrent.futures import ThreadPoolExecutor
executor = ThreadPoolExecutor(8)

input_tree = uproot.open('/path/10k_events_PFSimplePlainTree.root:PlainTree', decompression_executor=executor)

branches = input_tree.arrays(library='pd', decompression_executor=executor)

@jpivarski 和我在这个链接的问题中讨论了这个问题,他建议它可能只增加 10% 的内存,但对我来说超过 10%。可能多出 60-80%

4

0 回答 0