11 Optimizations

This chapter covers

  • Understanding Rust’s zero-cost abstractions
  • Using vectors effectively
  • Programming with SIMD in Rust
  • Parallelization with Rayon
  • Using Rust to accelerate other languages

In this final chapter, we’ll discuss optimization strategies with Rust. Rust’s zero-cost abstractions allow you to confidently write Rust code without thinking too hard about performance. Rust delegates much of its machine code generation to LLVM, which has mature, robust, widely deployed, and well-tested code optimization. Code written in Rust will be fast and well optimized without you spending time hand-tuning code.

There are, however, certain cases in which you may need to dive deeper, which we’ll discuss, along with the tools you’ll ...

Get Code Like a Pro in Rust now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.