Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
C++ High Performance

You're reading from   C++ High Performance Master the art of optimizing the functioning of your C++ code

Arrow left icon
Product type Paperback
Published in Dec 2020
Publisher Packt
ISBN-13 9781839216541
Length 544 pages
Edition 2nd Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Viktor Sehr Viktor Sehr
Author Profile Icon Viktor Sehr
Viktor Sehr
Björn Andrist Björn Andrist
Author Profile Icon Björn Andrist
Björn Andrist
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. A Brief Introduction to C++ 2. Essential C++ Techniques FREE CHAPTER 3. Analyzing and Measuring Performance 4. Data Structures 5. Algorithms 6. Ranges and Views 7. Memory Management 8. Compile-Time Programming 9. Essential Utilities 10. Proxy Objects and Lazy Evaluation 11. Concurrency 12. Coroutines and Lazy Generators 13. Asynchronous Programming with Coroutines 14. Parallel Algorithms 15. Other Books You May Enjoy
16. Index

Get the most out of this book

To get the most out of this book, you need to have a basic knowledge of C++. It's preferable that you have already faced problems related to performance and are now looking for new tools and practices to have ready for the next time you need to work with performance and C++.

There are a lot of code examples in this book. Some are taken from the real world, but most of them are artificial or vastly simplified examples to prove a concept, rather than provide you with production-ready code.

I have put all the code examples in source files divided by chapter so that it is fairly easy to find the examples you want to experiment with. If you open up the source code files, you will note that I have replaced most of the main() functions from the examples with test cases written with the Google Test framework. I hope that this will help you rather than confuse you. It allowed me to write helpful descriptions for each example, and it also makes it easier to run all the examples from one chapter at once.

In order to compile and run the examples, you will need the following:

  • A computer
  • An operating system (the examples have been verified on Windows, Linux, and macOS)
  • A compiler (I used Clang, GCC, and Microsoft Visual C++)
  • CMake

The CMake script provided with the example code will download and install further dependencies, such as Boost, Google Benchmark, and Google Test.

During the writing of this book, I found it helpful to use Compiler Explorer, which is available at https://godbolt.org/. Compiler Explorer is an online compiler service that lets you try various compilers and versions. Try it out if you haven't already!

Download the example code files

The code bundle for the book is hosted on GitHub at https://github.com/PacktPublishing/Cpp-High-Performance-Second-Edition. If there's an update to the code, it will be updated on the existing GitHub repository.

There are other code bundles from Packt's rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

Packt also provides a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://static.packt-cdn.com/downloads/9781839216541_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, folder names, filenames, file extensions, dummy URLs, and user input. Here is an example: "The keyword constexpr was introduced in C++11."

A block of code is set as follows:

#include <iostream>
int main() {
  std::cout << "High Performance C++\n"; 
}

When I wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

#include <iostream>
int main() {
  std::cout << "High Performance C++\n";
} 

Any command-line input or output is written as follows:

$ clang++ -std=c++20 high_performance.cpp
$ ./a.out
$ High Performance C++

Bold: Indicates a new term, an important word, or words that you see on the screen. For example: "Fill in the form and click on the Save button."

Warnings or important notes appear like this.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image