Transpiling Python to Rust for Optimized Performance

Research output: Chapter in Book/Report/Conference proceedingConference contributionScientificpeer-review

159 Downloads (Pure)

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.
Original languageEnglish
Title of host publicationEmbedded Computer Systems: Architectures, Modeling, and Simulation
Subtitle of host publication20th International Conference, SAMOS 2020, Samos, Greece, July 5–9, 2020, Proceedings
EditorsAlex Orailoglu, Matthias Jung, Marc Reichenbach
PublisherSpringer
Pages127-138
Number of pages11
Volume12471
ISBN (Electronic)978-3-030-60939-9
ISBN (Print)978-3-030-60938-2
DOIs
Publication statusPublished - 7 Oct 2020
Publication typeA4 Article in conference proceedings
EventInternational Conference on Embedded Computer Systems: Architectures, Modeling and Simulation -
Duration: 5 Jul 20209 Jan 2021

Publication series

NameLecture Notes in Computer Science
PublisherSpringer Link
Volume12471
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349

Conference

ConferenceInternational Conference on Embedded Computer Systems: Architectures, Modeling and Simulation
Period5/07/209/01/21

Keywords

  • Python
  • Rust
  • Embedded computing
  • Transpilation

Publication forum classification

  • Publication forum level 1

Fingerprint

Dive into the research topics of 'Transpiling Python to Rust for Optimized Performance'. Together they form a unique fingerprint.

Cite this