The Art of Writing Efficient Programs - Second Edition: Master high-performance C++ and modern concurrency by understanding how code runs on real hard
暫譯: 《高效能程式設計之道(第二版):理解程式碼在真實硬體上的執行方式,掌握高效能 C++ 與現代並行處理》

Pikus, Fedor G., Sutter, Herb

  • 出版商: Packt Publishing
  • 出版日期: 2026-09-28
  • 售價: $1,720
  • 貴賓價: 9.5 折 $1,634
  • 語言: 英文
  • 頁數: 702
  • 裝訂: Quality Paper - also called trade paper
  • ISBN: 1835465188
  • ISBN-13: 9781835465189
  • 相關分類: C++ 程式語言、Computer-architecture
  • 海外代購書籍(需單獨結帳)

相關主題

商品描述

Gain practical skills to optimize C++ programs using modern CPU architectures, memory models, and concurrency tools

Key Features:

- Apply advanced CPU, memory, and concurrency techniques to real-world code

- Design efficient thread-safe data structures using lock-free and atomic strategies

- Leverage compiler behavior and modern C++ standards for performance gains

Book Description:

Hardware stopped making your programs faster for free a long time ago. What it does instead is reward code that understands it, code written with a clear picture of how the CPU executes instructions, how memory really moves through caches, and what the compiler can and cannot do on your behalf. This book teaches that understanding, from first principles to the most advanced techniques, and shows you how to turn it into measurably faster software.

This edition is roughly half new and >60% longer. The coverage of CPU architecture (now including ARM), instruction processing, and the memory hierarchy, from caches to paging and virtual addressing, is expanded throughout. But the largest change is concurrency, which now makes up nearly half the book and is entirely rewritten: the memory model, atomic operations and atomic shared pointers, coroutine-based execution, NUMA-aware design, and a completely rewritten chapter on concurrent data structures that shows how cache coherency on modern hardware changes the established rules of lock-free programming, including advanced techniques such as helping.

Written by Fedor G. Pikus, industry leader in high-performance C++, with a foreword by Herb Sutter, this book equips you with both conceptual clarity and the hands-on techniques needed to make your software faster, leaner, and smarter.

What You Will Learn:

- Analyze and optimize CPU resource usage

- Improve memory access patterns across architectures

- Design performant multithreaded and lock-free systems

- Use atomic operations and smart pointers effectively

- Apply memory order guarantees for correctness and speed

- Evaluate compiler decisions and leverage vectorization

- Implement coroutine-based execution models

- Build APIs that scale in concurrent environments

Who this book is for:

Experienced C++ developers, performance-focused programmers, and engineers working in high-speed systems like trading platforms, games, or scientific computing. Prior knowledge of multithreading and memory management is required to make the most of this book.

Table of Contents

- Introduction to Performance and Concurrency

- Performance Measurements

- CPU Architecture, Resources, and Performance

- Memory Architecture and Performance

- Threads, Memory, and Concurrency

- Concurrency and Performance

- Data Structures for Concurrency

- Concurrency in C++

- High-Performance C++

- Compiler Optimizations in C++

- Undefined Behavior and Performance

- Design for Performance

商品描述(中文翻譯)

運用現代 CPU 架構、記憶體模型與並行工具,掌握最佳化 C++ 程式的實務技能

主要特色:

- 將進階 CPU、記憶體與並行技術應用於實際程式碼
- 運用無鎖(lock-free)與 atomic 策略,設計高效率且具執行緒安全性的資料結構
- 善用編譯器行為與現代 C++ 標準,提升程式效能

書籍簡介:

硬體早已不會再無條件地讓你的程式變快。相反地,硬體會獎勵那些理解它的程式碼:這類程式碼清楚掌握 CPU 如何執行指令、記憶體如何真正透過快取(cache)移動,以及編譯器能替你做什麼、不能替你做什麼。本書從基本原理一路講解至最進階的技術,教你建立這份理解,並將其轉化為可量測的軟體效能提升。

本版內容約有一半是全新內容,篇幅也增加了超過 60%。全書大幅擴充 CPU 架構(現在也涵蓋 ARM)、指令處理,以及從快取到分頁與虛擬定址的記憶體階層等主題。然而,最大的變革在於並行(concurrency)部分:目前幾乎佔全書一半,且完全重新撰寫。內容涵蓋記憶體模型、atomic 操作與 atomic shared pointer、以 coroutine 為基礎的執行方式、NUMA 感知設計,以及完全改寫的並行資料結構章節。該章說明現代硬體上的快取一致性如何改變既有的無鎖程式設計規則,並介紹包括 helping 在內的進階技術。

本書由高效能 C++ 領域的業界領導者 Fedor G. Pikus 撰寫,並由 Herb Sutter 撰寫序言。本書同時提供清晰的概念理解與實作所需的實務技術,協助你打造更快速、更精簡且更智慧的軟體。

你將學到:

- 分析並最佳化 CPU 資源的使用方式
- 改善跨不同架構的記憶體存取模式
- 設計高效能的多執行緒與無鎖系統
- 有效使用 atomic 操作與 smart pointer
- 應用記憶體順序保證,兼顧正確性與速度
- 評估編譯器的決策並善用向量化(vectorization)
- 實作以 coroutine 為基礎的執行模型
- 建構能在並行環境中擴展的 API

適合對象:

本書適合有經驗的 C++ 開發者、重視效能的程式設計師,以及從事交易平台、遊戲或科學運算等高速系統開發的工程師。讀者需事先具備多執行緒與記憶體管理的相關知識,才能充分發揮本書的效益。

目錄:

- 效能與並行簡介
- 效能測量
- CPU 架構、資源與效能
- 記憶體架構與效能
- 執行緒、記憶體與並行
- 並行與效能
- 並行程式設計的資料結構
- C++ 中的並行
- 高效能 C++
- C++ 中的編譯器最佳化
- 未定義行為與效能
- 以效能為導向的設計