Transpiling Python to Rust for Optimized Performance

3Citations
Citations of this article
6Readers
Mendeley users who have this article in their library.
Get full text

Abstract

Python has become the de facto programming language in machine learning and scientific computing, but high performance implementations are challenging to create especially for embedded systems with limited resources. We address the challenge of compiling and optimizing Python source code for a low-level target by introducing Rust as an intermediate source code step. We show that pre-existing Python implementations that depend on optimized libraries, such as NumPy, can be transpiled to Rust semi-automatically, with potential for further automation. We use two representative test cases, Black–Scholes for financial options pricing and robot trajectory optimization. The results show up to 12 × speedup and 1.5 × less memory use on PC, and the same performance but 4 × less memory use on an ARM processor on PYNQ SoC FPGA. We also present a comprehensive list of factors for the process, to show the potential for fully automated transpilation. Our findings are generally applicable and can improve the performance of many Python applications while keeping their easy programmability.

Cite

CITATION STYLE

APA

Lunnikivi, H., Jylkkä, K., & Hämäläinen, T. (2020). Transpiling Python to Rust for Optimized Performance. In Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics) (Vol. 12471 LNCS, pp. 127–138). Springer Science and Business Media Deutschland GmbH. https://doi.org/10.1007/978-3-030-60939-9_9

Register to see more suggestions

Mendeley helps you to discover research relevant for your work.

Already have an account?

Save time finding and organizing research with Mendeley

Sign up for free