Book description
Write code that scales across CPU registers, multi-core, and machine clusters
About This Book
- Explore concurrent programming in C++
- Identify memory management problems
- Use SIMD and STL containers for performance improvement
Who This Book Is For
If you're a C++ developer looking to improve the speed of your code or simply wanting to take your skills up to the next level, then this book is perfect for you.
What You Will Learn
- Find out how to use exciting new tools that will help you improve your code
- Identify bottlenecks to optimize your code
- Develop applications that utilize GPU computation
- Reap the benefits of concurrent programming
- Write code that can protect against application errors using error handling
- Use STL containers and algorithms effciently
- Extend your toolbox with Boost containers
- Achieve effcient memory management by using custom memory allocators
In Detail
C++ is a highly portable language and can be used to write complex applications and performance-critical code. It has evolved over the last few years to become a modern and expressive language. This book will guide you through optimizing the performance of your C++ apps by allowing them to run faster and consume fewer resources on the device they're running on. The book begins by helping you to identify the bottlenecks in C++. It then moves on to measuring performance, and you'll see how this affects the way you write code. Next, you'll see the importance of data structure optimization and how it can be used efficiently. After that, you'll see which algorithm should be used to achieve faster execution, followed by how to use STL containers. Moving on, you'll learn how to improve memory management in C++. You'll get hands on experience making use of multiple cores to enable more efficient and faster execution. The book ends with a brief overview of utilizing the capabilities of your GPU by using Boost Compute and OpenCL.
Style and approach
This easy-to-follow guide is full of examples and self-sufficient code snippets that help you with high performance programming with C++. You'll get your hands dirty with this all-inclusive guide that uncovers hidden performance improvement areas for any C++ code.
Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.
Publisher resources
Table of contents
- Preface
- A Brief Introduction to C++
-
Modern C++ Concepts
- Automatic type deduction with the auto keyword
- The lambda function
- Const propagation for pointers
- Move semantics explained
- Representing optional values with std::optional
- Representing dynamic values with std::any
- Summary
- Measuring Performance
- Data Structures
- A Deeper Look at Iterators
-
STL Algorithms and Beyond
-
Using STL algorithms as building blocks
-
STL algorithm concepts
- Algorithms operate on iterators
- Implementing a generic algorithm that can be used with any container
- Iterators for a range point to the first element and the element after the last
- Algorithms do not change the size of the container
- Algorithms with output require allocated data
- Algorithms use operator== and operator< by default
- Algorithms require move operators not to throw
- Algorithms have complexity guarantees
- Algorithms perform just as well as C library function equivalents
- STL algorithms versus handcrafted for-loops
-
STL algorithm concepts
- The future of STL and the ranges library
- Summary
-
Using STL algorithms as building blocks
- Memory Management
-
Metaprogramming and Compile-Time Evaluation
- Introduction to template metaprogramming
- Type traits
- The constexpr keyword
- Heterogeneous containers
- The std::variant
- Real world examples of metaprogramming
- Summary
- Proxy Objects and Lazy Evaluation
- Concurrency
-
Parallel STL
- Importance of parallelism
- Parallel algorithms
- Parallel STL
- Executing STL algorithms on the GPU
- Boost Compute
- Other Books You May Enjoy
Product information
- Title: C++ High Performance
- Author(s):
- Release date: January 2018
- Publisher(s): Packt Publishing
- ISBN: 9781787120952
You might also like
book
Expert C++
Design and architect real-world scalable C++ applications by exploring advanced techniques in low-level programming, object-oriented programming …
book
The Linux Programming Interface
The Linux Programming Interface is the definitive guide to the Linux and UNIX programming interface—the interface …
book
Advanced C++
Become an expert at C++ by learning all the key C++ concepts and working through interesting …
book
C++ Concurrency in Action, Second Edition
C++ Concurrency in Action, Second Edition is the definitive guide to writing elegant multithreaded applications in …