Accelerating Performance by Incrementally Integrating Rust Into Existing Codebase

Summary

Disclaimer: This summary has been generated by AI. It is experimental, and feedback is welcomed. Please reach out to info@qconsf.com with any comments or concerns.

The presentation titled 'Accelerating Performance by Incrementally Integrating Rust Into Existing Codebase' by Lily Mara explores strategies for enhancing software performance through selective integration of Rust into existing codebases.

Key Points Discussed:

  • Feasibility of Incremental Refactoring: The presentation emphasizes the benefits of reimplementing performance-critical components in Rust rather than undertaking full application rewrites, which can introduce bugs and exceed deadlines.
  • Performance Improvements: Benchmarking shows that Rust can significantly outperform dynamic languages like Python, running operations over 100 times faster in some cases. This performance boost can lead to substantial reductions in CPU costs.
  • Integration Techniques: By using Foreign Function Interface (FFI) techniques, individual functions can be rewritten in Rust and seamlessly integrated with existing systems like Python, often resulting in improved memory safety and speed.
  • Testing and Maintenance: The importance of cross-language regression testing and benchmarking is highlighted to ensure the new implementations do not introduce new issues. Customized testing strategies using dependency injection for old and new implementations are recommended.
  • Macro vs. Micro Benchmarking: While micro benchmarks show great improvements, macro benchmarking reveals more holistic performance impacts, such as a 15% improvement in overall system efficiency.

Conclusion: Incrementally integrating Rust into existing codebases can yield significant performance gains, helping organizations save on infrastructure costs and improve system efficiency without the risks associated with full rewrites. The session also underscores the practical application of these techniques in real-world scenarios, such as in projects at Discord.

This is the end of the AI-generated content.


Abstract

In order to improve the performance of existing applications and services, we can identify the most performance-critical pieces and reimplement them in Rust as opposed to completely rewriting the applications from scratch.

It’s tempting when we hear about a new technology or language to want to rewrite everything using that technology. Start over with a clean slate and fix all the problems of the old system. The new shiny system will surely be better than the last one! The constraints of reality often encroach on this fantasy as rewrite projects. They turn into seemingly never-ending projects due to bugs reemerging - bugs the old system contorted itself into to fix. In pursuit of improving performance, we can rewrite only those pieces of an application that are truly important to performance and use cross-language bindings in order to link existing code bases with code written in Rust.

In this talk, we will take an existing codebase and rewrite part of it in Rust. We will focus on:

  • Determining the feasibility of this type of refactor
  • Write a Rust reimplementation of existing behavior
  • Cross-language regression testing
  • Performance benchmarking of the new code


 


Speaker

Lily Mara

Staff Engineer @Discord, Author of "Refactoring to Rust", Previously Engineering Manager @OneSignal

Lily Mara is a Staff Engineer at Discord on the Notifications Platform team. She builds distributed systems to deliver tens of billions of notifications every day to Discord's users.

Previously she was an Engineering Manager and Software Engineer at OneSignal in San Mateo, CA.

Lily is the author of Refactoring to Rust, a book about improving the performance of existing software systems through the gradual addition of Rust code.

Read more
Find Lily Mara at:

Date

Wednesday Nov 19 / 02:45PM PST ( 50 minutes )

Location

Pacific DEKJ

Topics

Performance Emerging Languages Foreign Function Interface

Share

From the same track

Session Rust

The Rust High Performance Talk You Did Not Expect

Wednesday Nov 19 / 10:35AM PST

Rust runs faster, but it slows down engineers, right? This was our team’s assumption when we decided to rewrite our code from Kotlin into Rust. But we were wrong in completely unexpected ways.

Speaker image - Ruth Linehan

Ruth Linehan

Software Engineer @Momento, Previously APIs/Webhooks @GitHub and @Puppet

Session Performance

When Every Bit Counts: How Valkey Rebuilt Its Hashtable for Modern Hardware

Wednesday Nov 19 / 01:35PM PST

Ever wondered what happens when a bunch of performance-obsessed developers decide their blazing-fast database isn't quite blazing-fast enough?

Speaker image - Madelyn Olson

Madelyn Olson

Principal Engineer @AWS, Maintainer of the Open-Source Valkey Project

Session

Instrumentation at Scale: Having Your Performance Cake and Eating It Too

Wednesday Nov 19 / 11:45AM PST

In high-performance code, a single misplaced counter increment can cost more than the operation it’s measuring. That creates a paradox: instrument too much and you slow the system down; instrument too little and you miss the insights you need to continuously deliver.

Speaker image - Brian Martin

Brian Martin

Co-founder and Software Engineer @IOP Systems, Focused on High-Performance Software and Systems, Previously @Twitter

Session Python

Python, Numba, and Algorithm Design: Building Efficient Models in Financial Services

Wednesday Nov 19 / 03:55PM PST

The popularity of Python means insurance and financial services companies have a growing body of actuaries, quantitative developers, and software engineers capable of building innovative and customized solutions for both data management and modeling.

Speaker image - Chad Schuster

Chad Schuster

Principal @Milliman Focusing on Risk Management, Modeling, and Technology Consulting Services