售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Title Page
Copyright and Credits
Rust High Performance
Dedication
Packt Upsell
Why subscribe?
PacktPub.com
Contributors
About the author
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Get in touch
Reviews
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
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
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
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
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
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
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
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
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
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
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
Leave a review - let other readers know what you think
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜