My Account Log in

3 options

Rust high performance : learn to skyrocket the performance of your Rust applications / Iban Eguia Moraza.

EBSCOhost Academic eBook Collection (North America) Available online

View online

Ebook Central College Complete Available online

View online

O'Reilly Online Learning: Academic/Public Library Edition Available online

View online
Format:
Book
Author/Creator:
Moraza, Iban Eguia, author.
Language:
English
Subjects (All):
Programming languages (Electronic computers).
Physical Description:
1 online resource (272 pages)
Edition:
1st edition
Place of Publication:
Birmingham ; Mumbai : Packt Publishing, 2018.
System Details:
text file
Summary:
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. Learn metaprogramming in Rust. Who This Book Is For This book is for Rust developers keen to improve the speed of their code or simply to take their skills to the next level. What You Will Learn Master tips and tricks to make your code faster. Learn how to identify bottlenecks in your Rust applications Discover how to profile your Rust software. Understand the type system to create compile-time optimizations. Master the borrow checker . Learn metaprogramming in Rust to avoid boilerplate code. Discover multithreading and work stealing in Rust. Understand asynchronous programming in Rust. In Detail At times, it is difficult to get the best performance out of Rust. This book teaches you to optimize the speed of your Rust code to the level of languages such as C/C++. You'll understand and fix common pitfalls, learn how to improve your productivity by using metaprogramming, and speed up your code by concurrently executing parts of it safely and easily. You will master the features of the language which will make you stand out and use them to really improve the efficiency of your algorithms The book begins with a gentle introduction to help you identify bottlenecks when programming in Rust. We highlight common performance pitfalls, along with strategies to detect and resolve these issues early. We move on to mastering Rust's type system, which will enable us to create impressive optimizations in both performance and safety at compile time. You will then learn how to effectively manage memory in Rust, mastering the borrow checker. We move on to measuring performance and you will see how this affects the way you write code. Moving ahead, you will perform metaprogramming in Rust to boost the performance of your code and your productivity. You will finally learn parallel programming in Rust, which enables efficient and faster execution by using multithreading and asynchronous programming. Style and approach You'll embark on a learning journey that will teach about you deep-core concepts in the Rust language. Learning those concepts - such as understanding the borrow checker - will make you competent to write more efficient Rust code. To learn those core concept...
Contents:
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
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
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
Casting
Bad practice
Performance lints
Unwraps
Shadowing
Integer overflow
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
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
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
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
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
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
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
Other Books You May Enjoy
Index.
Notes:
Description based on print version record.
OCLC:
1030821097

The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.

Find

Home Release notes

My Account

Shelf Request an item Bookmarks Fines and fees Settings

Guides

Using the Find catalog Using Articles+ Using your account