Using a DSL to read ROOT TTrees faster in Uproot

03/03/2023
by   Aryan Roy, et al.
0

Uproot reads ROOT TTrees using pure Python. For numerical and (singly) jagged arrays, this is fast because a whole block of data can be interpreted as an array without modifying the data. For other cases, such as arrays of std::vector<std::vector<float>>, numerical data are interleaved with structure, and the only way to deserialize them is with a sequential algorithm. When written in Python, such algorithms are very slow. We solve this problem by writing the same logic in a language that can be executed quickly. AwkwardForth is a Domain Specific Language (DSL), based on Standard Forth with I/O extensions for making Awkward Arrays, and it can be interpreted as a fast virtual machine without requiring LLVM as a dependency. We generate code as late as possible to take advantage of optimization opportunities. All ROOT types previously implemented with Python have been converted to AwkwardForth. Double and triple-jagged arrays, for example, are 400x faster in AwkwardForth than in Python, with multithreaded scaling up to 1 second/GB because AwkwardForth releases the Python GIL. We also investigate the possibility of JIT-compiling the generated AwkwardForth code using LLVM to increase the performance gains. In this paper, we describe design aspects, performance studies, and future directions in accelerating Uproot with AwkwardForth.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
02/24/2021

AwkwardForth: accelerating Uproot with an internal DSL

File formats for generic data structures, such as ROOT, Avro, and Parque...
research
11/29/2018

Autoconj: Recognizing and Exploiting Conjugacy Without a Domain-Specific Language

Deriving conditional and marginal distributions using conjugacy relation...
research
03/03/2023

The Awkward World of Python and C++

There are undeniable benefits of binding Python and C++ to take advantag...
research
07/20/2021

PandaPy: A Wrapper Around Structured Arrays to Mimic ‘Structs’ in the C Language

Similar to the original Pandas project, PandaPy is developed to improve ...
research
01/15/2020

Awkward Arrays in Python, C++, and Numba

The Awkward Array library has been an important tool for physics analysi...
research
04/05/2023

Efficient and Accurate Automatic Python Bindings with cppyy Cling

The simplicity of Python and the power of C++ force stark choices on a s...
research
10/01/2020

Scipp: Scientific data handling with labeled multi-dimensional arrays for C++ and Python

Scipp is heavily inspired by the Python library xarray. It enriches raw ...

Please sign up or login with your details

Forgot password? Click here to reset