Rust high performance learn to skyrocket the performance of your Rust applications
Find bottlenecks, identify the proper algorithm to use, optimize performance, and create really efficient Rust applications About This Book Understand common performance pitfalls and improve the performance of your applications. Get to grips with parallel programming and multithreading with Rust. Le...
Otros Autores: | |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Birmingham ; Mumbai :
Packt Publishing
2018.
|
Edición: | 1st edition |
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009631611806719 |
Tabla de Contenidos:
- Cover
- Title Page
- Copyright and Credits
- Dedication
- Packt Upsell
- Contributors
- Table of Contents
- Preface
- Chapter 1: Common Performance Pitfalls
- Asking the Rust compiler about performance
- Optimizations
- Build configuration
- Optimization level
- Debug information
- Link-time optimizations
- Debug assertions
- Panic behavior
- Runtime library paths
- Translation issues
- Indexing degradations
- Using iterators
- Iterator adaptors
- Real-life example
- Specialized adaptors
- Interaction between adaptors
- Itertools
- Borrowing degradations
- Cyclomatic complexity
- Summary
- Chapter 2: Extra Performance Enhancements
- Compile-time checks
- Sequential state machines
- Complex state machines
- Real-life type system check example
- Extra performance tips
- Using closures to avoid runtime evaluation
- Unstable sorting
- Map hashing
- Perfect hash functions
- Standard library collections
- Sequences
- Maps
- Sets
- Summary
- Chapter 3: Memory Management in Rust
- Mastering the borrow checker
- Allocations
- Mutability, borrowing, and owning
- Lifetimes
- Memory representation
- Alignment
- Complex enumerations
- Unions
- Shared pointers
- The cell module
- Cells
- RefCell
- The rc module
- Summary
- Chapter 4: Lints and Clippy
- Using Rust compiler lints
- Lints
- Avoiding anonymous parameters
- Avoiding heap allocated box pointers
- Avoiding missing implementations
- Enforcing documentation
- Pointing out trivial casts
- Linting unsafe code blocks
- Unused lints
- Variant size differences
- Lint groups
- Clippy
- Installation
- Configuration
- Lints
- Casting
- Bad practice
- Performance lints
- Unwraps
- Shadowing
- Integer overflow
- Lint groups
- Summary
- Chapter 5: Profiling Your Rust Application
- Understanding the hardware.
- Understanding how the CPU works
- Speeding up memory access with the cache
- Cache misses
- How can you fix it?
- Cache invalidation
- CPU pipeline
- Branch prediction
- The relevance of branch prediction for our code
- Profiling tools
- Valgrind
- Callgrind
- Cachegrind
- OProfile
- Summary
- Chapter 6: Benchmarking
- Selecting what to benchmark
- Benchmarking in nightly Rust
- Benchmarking in stable Rust
- Continuous integration for benchmarks
- Travis-CI integration
- Benchmark statistics with Criterion
- Summary
- Chapter 7: Built-in Macros and Configuration Items
- Understanding attributes
- Trait derivations
- Crate features
- Configuration attributes
- Macros
- Console printing
- String formatting
- Compilation environment
- Loading byte arrays and strings at compile time
- Code paths
- Checking preconditions and postconditions
- Others
- Nightly Rust
- Conservative trait return
- Constant functions
- Inline assembly and naked functions
- Using bigger integers
- Single instruction multiple data
- Allocation API
- Compiler plugins
- Summary
- Chapter 8: Must-Have Macro Crates
- Working with external data
- Data serialization and deserialization
- Serializing and deserializing complex structures
- Parsing byte streams
- Learning about useful small crates
- Creating lazily evaluated statics
- Avoiding boilerplate code for the builder pattern
- Managing errors
- Logging efficiently in Rust
- Creating command-line interfaces
- Using Rust for web development
- Creating extremely efficient templates
- Connecting with a database
- Creating a complete web server
- Summary
- Chapter 9: Creating Your Own Macros
- Creating your own standard macros
- Macro variants
- Complex macros
- Creating procedural macros
- Implementing a simple trait
- Implementing complex derivations.
- Implementing getters
- Implementing setters
- Metaprogramming in nightly Rust
- Understanding compiler plugins
- Declarative macros
- Summary
- Chapter 10: Multithreading
- Concurrency in Rust
- Understanding the Send and Sync traits
- The Send trait
- The Sync trait
- Other types of concurrency in Rust
- Understanding multithreading
- Creating threads
- Panicking in Rust
- Moving data between threads
- The move keyword
- Sharing data between threads
- Channels between threads
- Multithreading crates
- Non-blocking data structures
- Scoped threads
- Thread pooling
- Parallel iterators
- Summary
- Chapter 11: Asynchronous Programming
- Introduction to asynchronous programming
- Understanding I/O in the CPU
- Getting the kernel to control the I/O
- Asynchronous programming from the programmer's perspective
- Understanding futures
- Future combinators
- Asynchronous I/O in Rust
- Creating Tokio codecs
- WebSockets in Rust
- Understanding the new Generators
- Summary
- Other Books You May Enjoy
- Index.