Kessler.rs

2023-01-01

Kessler.rs is a software project developed to be a performant open source library for computing the initial conditions of an in-orbit fragmentation event. This project was motivated by two primary factors: improving the simulation tool's performance and learning to write Rust, a lower-level programming language known for its memory safety and performance.

💻

The project is fully open source and is available on GitHub.

Fast and Safe simulations

During college, I worked on a thesis project on orbital debris cloud propagation that required me to develop an orbital debris simulation based on the NASA standard breakup model. Although I completed the simulation, my tool of choice, Python, was not well suited for the task.

While I had used all of the Python playbook tricks to improve my simulation's performance - JIT compilation, Cython, and frequent use of NumPy arrays - I found that it was often cumbersome to write code that was both fast and safe. As such, I decided to rewrite the simulation in Rust, a lower-level?* programming language known for its memory safety and performance.

The results spoke for themselves. By rewriting the simulation in Rust, I improved the simulation performance by an order of magnitude, in addition to making the code scale better with the number of debris fragments.

The following table compares the Python performance to the Rust performance for a satellite explosion with a mass of 849kg and the number of debris fragments produced. Note that this is only to give a rough idea of the performance of the simulation. Due to the statistical nature of the simulation, the results will vary slightly each time the simulation is run. A future blog post will discuss a more thorough comparison of the performance of the Python and Rust simulations.

Library VersionCharacteritic Length [m]Pieces of debris generatedExecution time (s)
Python0.12380.43
Python0.0195090.65
Python0.0013785745.71
Python0.000115071318212.32
Rust0.12380.42
Rust0.0195090.41
Rust0.0013785740.59
Rust0.0001150713224.68

The foray into Rust

The Kesspy project provided an opportunity to dive into Rust's capabilities and compare its performance with Python for the orbital debris simulation. The following key takeaways were observed:

  • Significant performance improvements were achieved by rewriting the simulation in Rust.
  • Rust's memory safety and borrow checker proved beneficial for developing high-performance applications.
  • The project emphasized the importance of understanding and adapting to Rust's unique paradigms.

From an analytical perspective, the results of the Kesspy project demonstrate the value of choosing the right programming language for a specific task. The performance comparison table highlights the advantages Rust offers over Python for this particular application, especially when dealing with large numbers of debris fragments.

The next steps for the Kesspy project include:

  • Refining the existing Rust implementation to further optimize performance.
  • Investigating additional features or enhancements that could improve the simulation's capabilities.
  • Sharing insights and experiences with the Rust community to support other developers.

Lastly, I encourage those interested in Rust or orbital debris simulations to explore the Kesspy project on GitHub. Contributions and feedback are always welcome, as they will help to advance the field of orbital debris research and enhance the tools available for such studies.