Rust High Performance
Rust High Performance
Summary:
Introduction
The book «Rust High Performance» (author Iban Eguia Moraza, 2018, 366 pages) is a practical guide to writing the fastest and most efficient code in the Rust language. Unlike many introductory materials, this book focuses specifically on performance: from basic principles to low-level tricks with unsafe and SIMD. It will be useful for developers who are already familiar with the basics of Rust and want to squeeze every bit of performance out of it.
What the book is about
The book is structured as a sequential dive into the world of optimization. The author starts with general concepts (execution time, algorithm complexity) and gradually moves on to Rust-specific topics: memory management, profiling, concurrency, using unsafe code, SIMD instructions, and interfacing with C. Each chapter contains not only theory but also practical code examples that can be run and tested.
Main topics
- Profiling and benchmarking (cargo bench, perf, flamegraph).
- Memory optimization: stack, heap, allocators, cache misses.
- Parallelism and concurrency: threads, async/await, channels, lock-free structures.
- Safe and unsafe code: when and how to use unsafe.
- SIMD (Single Instruction Multiple Data) for vector operations.
- FFI (Foreign Function Interface) — calling C libraries and optimizing the interface.
- Compiler optimizations: flags, LTO, link-time optimization.
Who this book is for
The book is aimed at developers already familiar with Rust (syntax, ownership, borrowing). If you are just starting to learn the language, it is better to first read «The Rust Programming Language» or «Rust in Action». But if you have already written several projects and want to understand how to make them faster — this book is for you.
What the reader will learn
- How to properly profile Rust applications and find bottlenecks.
- How to write benchmarks and interpret their results.
- How memory works in Rust and how to minimize allocations.
- How to safely use unsafe to improve performance.
- How to apply SIMD instructions for data processing.
- How to organize parallel computations without data races.
- How to optimize interaction with C libraries.
- Which compiler flags and Cargo settings affect speed.
Strengths
- Practical focus. Almost every chapter contains ready-to-use code that can be tried immediately.
- Deep dive into unsafe. Many books avoid this topic, but here a whole chapter is dedicated to it with examples.
- Emphasis on tools. Detailed coverage of perf, Valgrind, cachegrind, flamegraph — tools that professionals actually use.
- Modernity (at the time of release). The book covers Rust 2018 edition and the crates that were relevant at that time.
Weaknesses
- Outdatedness. Since 2018, Rust has changed significantly: async/await appeared (stabilized in 2019), new profiling tools. Some examples may not compile without adaptation.
- Lack of coverage on async. The book was released before the stabilization of async/await, so this topic is covered superficially.
- Difficulty for beginners. As already mentioned, a solid knowledge of Rust basics is required.
Who is recommended
- Rust developers who want to move from «just working code» to «fast code».
- Engineers working on high-load systems, games, databases, network services.
- Those interested in low-level optimization and willing to work with unsafe.
- Students and teachers of systems programming courses.
Conclusion
«Rust High Performance» is a quality, though slightly outdated
Recommendations
Rust and Kubernetes: Building Reliable Microservices
JavaScript (Node.js) and Docker: Containerizing Applications
Concurrency in PHP: Asynchrony, Parallelism, and Multithreading in Practice
Designing Modern Web Applications with ASP.NET Core and Azure
Parallel Programming in Rust: A Practical Guide
PHP and MySQL: From Novice to Ninja