Transpiling Python to Rust for Optimized Performance

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

159 Downloads (Pure)


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
Number of pages11
ISBN (Electronic)978-3-030-60939-9
ISBN (Print)978-3-030-60938-2
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
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349


ConferenceInternational Conference on Embedded Computer Systems: Architectures, Modeling and Simulation


  • Python
  • Rust
  • Embedded computing
  • Transpilation

Publication forum classification

  • Publication forum level 1


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

Cite this