Tuplex: Data science in python at native code speed
Proceedings of the 2021 International Conference on Management of Data, 2021•dl.acm.org
Today's data science pipelines often rely on user-defined functions (UDFs) written in Python.
But interpreted Python code is slow, and Python UDFs cannot be compiled to machine code
easily. We present Tuplex, a new data analytics framework that just in-time compiles
developers' natural Python UDFs into efficient, end-to-end optimized native code. Tuplex
introduces a novel dual-mode execution model that compiles an optimized fast path for the
common case, and falls back on slower exception code paths for data that fail to match the …
But interpreted Python code is slow, and Python UDFs cannot be compiled to machine code
easily. We present Tuplex, a new data analytics framework that just in-time compiles
developers' natural Python UDFs into efficient, end-to-end optimized native code. Tuplex
introduces a novel dual-mode execution model that compiles an optimized fast path for the
common case, and falls back on slower exception code paths for data that fail to match the …
Today's data science pipelines often rely on user-defined functions (UDFs) written in Python. But interpreted Python code is slow, and Python UDFs cannot be compiled to machine code easily.
We present Tuplex, a new data analytics framework that just in-time compiles developers' natural Python UDFs into efficient, end-to-end optimized native code. Tuplex introduces a novel dual-mode execution model that compiles an optimized fast path for the common case, and falls back on slower exception code paths for data that fail to match the fast path's assumptions. Dual-mode execution is crucial to making end-to-end optimizing compilation tractable: by focusing on the common case, Tuplex keeps the code simple enough to apply aggressive optimizations. Thanks to dual-mode execution, Tuplex pipelines always complete even if exceptions occur, and Tuplex's post-facto exception handling simplifies debugging.
We evaluate Tuplex with data science pipelines over real-world datasets. Compared to Spark and Dask, Tuplex improves end-to-end pipeline runtime by 5-91x and comes within 1.1-1.7x of a hand-optimized C++ baseline. Tuplex outperforms other Python compilers by 6x and competes with prior, more limited query compilers. Optimizations enabled by dual-mode processing improve runtime by up to 3x, and Tuplex performs well in a distributed setting on serverless functions.
ACM Digital Library