Refresh Your Home For Fall
To see product details, add this item to your cart. You can always remove it later.
Shipper / Seller
Amazon.com
Amazon.com
Shipper / Seller
Amazon.com
Returns
30-day refund / replacement
30-day refund / replacement
This item can be returned in its original condition for a full refund or replacement within 30 days of receipt.
Read full return policy
Payment
Secure transaction
Your transaction is secure
We work hard to protect your security and privacy. Our payment security system encrypts your information during transmission. We don’t share your credit card details with third-party sellers, and we don’t sell your information to others. Learn more
Gift options
Available at checkout
Available at checkout This item is a gift. Change
At checkout, you can add a custom message, a gift receipt for easy returns and have the item gift-wrapped
Added to

Sorry, there was a problem.

There was an error retrieving your Wish Lists. Please try again.

Sorry, there was a problem.

List unavailable.
Kindle app logo image

Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.

Read instantly on your browser with Kindle for Web.

Using your mobile phone camera - scan the code below and download the Kindle app.

QR code to download the Kindle App

  • The Art of Writing Efficient Programs: An advanced programmer's guide to efficient hardware utilization and compiler optimizations using C++ examples

Follow the author

Get new release updates & improved recommendations
Something went wrong. Please try your request again later.

The Art of Writing Efficient Programs: An advanced programmer's guide to efficient hardware utilization and compiler optimizations using C++ examples

4.6 out of 5 stars (90)

Purchase options and add-ons

Become a better programmer with performance improvement techniques such as concurrency, lock-free programming, atomic operations, parallelism, and memory management

Key Features

  • Learn proven techniques from a heavyweight and recognized expert in C++ and high-performance computing
  • Understand the limitations of modern CPUs and their performance impact
  • Find out how you can avoid writing inefficient code and get the best optimizations from the compiler
  • Learn the tradeoffs and costs of writing high-performance programs

Book Description

The great free lunch of "performance taking care of itself" is over. Until recently, programs got faster by themselves as CPUs were upgraded, but that doesn't happen anymore. The clock frequency of new processors has almost peaked, and while new architectures provide small improvements to existing programs, this only helps slightly. To write efficient software, you now have to know how to program by making good use of the available computing resources, and this book will teach you how to do that.

The Art of Efficient Programming covers all the major aspects of writing efficient programs, such as using CPU resources and memory efficiently, avoiding unnecessary computations, measuring performance, and how to put concurrency and multithreading to good use. You'll also learn about compiler optimizations and how to use the programming language (C++) more efficiently. Finally, you'll understand how design decisions impact performance.

By the end of this book, you'll not only have enough knowledge of processors and compilers to write efficient programs, but you'll also be able to understand which techniques to use and what to measure while improving performance. At its core, this book is about learning how to learn.

What you will learn

  • Discover how to use the hardware computing resources in your programs effectively
  • Understand the relationship between memory order and memory barriers
  • Familiarize yourself with the performance implications of different data structures and organizations
  • Assess the performance impact of concurrent memory accessed and how to minimize it
  • Discover when to use and when not to use lock-free programming techniques
  • Explore different ways to improve the effectiveness of compiler optimizations
  • Design APIs for concurrent data structures and high-performance data structures to avoid inefficiencies

Who this book is for

This book is for experienced developers and programmers who work on performance-critical projects and want to learn new techniques to improve the performance of their code. Programmers in algorithmic trading, gaming, bioinformatics, computational genomics, or computational fluid dynamics communities will get the most out of the examples in this book, but the techniques are fairly universal. Although this book uses the C++ language, the concepts demonstrated in the book can be easily transferred or applied to other compiled languages such as C, Java, Rust, Go, and more.

Table of Contents

  1. Introduction to Performance and Concurrency
  2. Performance Measurements
  3. CPU Architecture, Resources, and Performance Implications
  4. Memory Architecture and Performance
  5. Threads, Memory, and Concurrency
  6. Concurrency and Performance
  7. Data Structures for Concurrency
  8. Concurrency in C++
  9. High-Performance C++
  10. Compiler Optimizations in C++
  11. Undefined Behavior and Performance
  12. Design for Performance

Frequently bought together

This item: The Art of Writing Efficient Programs: An advanced programmer's guide to efficient hardware utilization and compiler optimizations using C++ examples
$39.59
Get it as soon as Monday, Sep 21
In Stock
Ships from and sold by Amazon.com.
+
$29.99
Get it as soon as Monday, Sep 21
In Stock
Ships from and sold by Amazon.com.
+
$48.99
Get it as soon as Sunday, Sep 20
In Stock
Ships from and sold by Amazon.com.
Total price: $00
To see our price, add these items to your cart.
Details
Added to Cart
Choose items to buy together.

Customers also bought or read

Loading...

From the brand


From the Publisher

B16229 - top
B16229 - 1

How has your background helped you to write this book?

I started programming as a college student when even the simplest programs had to be written with performance in mind. While times have changed, I kept finding myself working in the areas where the hardware capabilities were never enough: first, in computational physics and then in electronic design automation. By choice or circumstance, I have always been programming close to hardware - the skill that is in demand once more in recent years in areas like low latency and high-performance concurrency. As for compilers, their ability to improve performance is miles ahead of what it once was, and so is the potential magnitude of the failure when the expected performance boost does not materialize due to a quirk of the language or a peculiarity of the hardware interfering with the programmer's intent. All in all, I found the old habits, if not the old knowledge, relevant again in the modern age of high-performance computing.

code screen

What part or parts of the book are your favorite, and why?

Several parts, and the experience of writing them, stand out in my memory. First of all, it's the chapter on designing for performance. So often, performance is considered a feature to be added later. The mantra "do not optimize prematurely" is as widely known as it is misunderstood; its intended meaning is much more nuanced than most programmers realize. The idea that performance targets are as much a part of the original design specification as the feature list often comes as a surprise; if I can teach one thing to the readers of my book, I would want it to be this idea.

Other favorite moments are the ones where I found and presented some minor or innocuous change that has an unexpectedly large effect on performance. Certain compiler optimizations, seemingly trivial changes to memory access, and clever concurrent algorithms all have that element of surprise and even disbelief: "It does WHAT?"

computer

In what ways have you been active in the community?

Mostly in various educational activities, like conference presentations and CppCon Academy classes. Sharing my knowledge and having the knowledge and experience of others shared with me are where I find my role in the C++ community most useful.

B16229

What makes this book better than other similar titles?

Obviously, the content, the presentation, and the style! Seriously though, there are several strengths of the book in my mind. First is the emphasis on not just imparting knowledge and information, but explaining how we came to know what we know, and how such knowledge can be re-discovered when the next generations of hardware, languages, and compilers will make the guidelines of today obsolete. In this way, it is a book about learning to learn. Second is the scope, the breadth of it: it is rare to find, in one place, the presentation of the performance effects that originate from the hardware, the compilers, the language features, and the design decisions, and their mutual interactions.

Editorial Reviews

About the Author

Fedor G. Pikus is a chief engineering scientist in the Mentor IC Segment of Siemens Digital Industries Software and is responsible for the long-term technical direction of Calibre products, the design and architecture of software, and research into new software technologies. His previous roles included senior software engineer at Google and chief software architect at Mentor Graphics. Fedor is a recognized expert in high-performance computing and C++. He has presented his works at CPPCon, SD West, DesignCon, and in software development journals, and is also an O'Reilly author. Fedor has over 25 patents and over 100 papers and conference presentations on physics, EDA, software design, and C++.

Product details

  • Publisher ‏ : ‎ Packt Publishing
  • Publication date ‏ : ‎ October 22, 2021
  • Language ‏ : ‎ English
  • Print length ‏ : ‎ 464 pages
  • ISBN-10 ‏ : ‎ 1800208111
  • ISBN-13 ‏ : ‎ 978-1800208117
  • Item Weight ‏ : ‎ 7.4 ounces
  • Dimensions ‏ : ‎ 7.5 x 1.05 x 9.25 inches
  • Best Sellers Rank: #203,482 in Books (See Top 100 in Books)
  • Customer Reviews:
    4.6 out of 5 stars (90)

About the author

Follow authors to get new release updates, plus improved recommendations.
Fedor G Pikus
Brief content visible, double tap to read full content.
Full content visible, double tap to read brief content.

Fedor G Pikus is a Technical Fellow at Siemens Digital Industries Software and the director of the Advanced Projects Team. His earlier positions included a Senior Software Engineer at Google and a Chief Software Architect for Calibre PERC, LVS, and DFM at Mentor Graphics. He joined Mentor Graphics in 1998 when he made a switch from academic research in computational physics to the software industry. Fedor is a recognized expert on high-performance computing and C++, he presented his works at C++Now, CPPCon, SD West, DesignCon, in Software Development Journal, and is also an O'Reilly author. His responsibilities as a Chief Scientist include planning the long-term technical direction of Calibre products, directing and training the engineers who work on these products, design, and architecture of the software, and research in new design and software technologies. Fedor has over 25 patents and over 100 papers and conference presentations on physics, EDA, software design, and C++ language.