Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8561063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:25:05+00:00 2026-06-11T16:25:05+00:00

I’m looking for resources (ideally a book) that will help me gain an in-depth

  • 0

I’m looking for resources (ideally a book) that will help me gain an in-depth understanding of C++ performance. Here’s a little more background:

I write server software with very high throughput requirements and/or low latency requirements. We write in C++; it’s not really up for debate at this time. Most of my colleagues seem to have a much better understanding of C++ performance. They have better mental models, so they can tell when a certain bit of code will perform poorly at scale. I lack this understanding, and so I’m looking to improve my mental model.

I am specifically interested in:

  • Understanding cache effects, and how cache locality due to object layout affects my code’s performance. This is the number one issue that seems to be brought up by other members of my team.
  • Understanding how memory allocation otherwise affects performance. Should I be using TCMalloc (or other mallocs), and how should I know? How should I tune the various allocation and deallocation parameters?
  • How do I know when the overhead from object copying will matter (and therefore should switch to pointers, for example)?
  • I’m also generally interested in “optimizations” as long as I have the knowledge as to when to use them.

Things I’m not really interested in:

  • “High Performance Computing,” a term which seems indicate more math/simulation-oriented applications.
  • Discussions of C++ performance relative to other languages, since I’m stuck with C++.

As a starting point, anyone know if this book, Efficient C++, would fit the bill?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:25:07+00:00Added an answer on June 11, 2026 at 4:25 pm

    Let me split my recommendations into several sections.

    C++ Optimization

    As a starting point, I would highly recommend Agner Fog’s Optimizing software in C++. This manual gives an excellent overview of the common C++ optimization topics.

    Understanding Hardware in General

    To have a good mental model of the C++ performance, you also need to understand the underlying hardware. Consider this statement:

    a[7] = 5;
    

    On the C++ language side, the line of code is boring from the performance perspective: it’s just one memory write. But, on real hardware, the performance of that memory write can vary by orders of magnitude. To understand what’s going on at that level, you need to learn about concepts such as caches, processor pipeline, TLB, branch prediction, and so on.

    As a quick introduction to processor caches, I’d recommend my article Gallery of Processor Cache Effects. A much deeper and longer (>100 pages) discussion of caches and computer memory is What Every Programmer Should Know About Memory.

    To get an overall understanding of modern computer hardware, Computer Architecture: A Quantitative Approach is the commonly recommended book. I didn’t read the book myself, but instead learned by reading blogs and experimentation. However, others have apparently found the book to be very useful.

    Understanding Specific Processors

    At one point in your journey to improve your optimization skills, you’ll find it useful to recognize specifics of different processors. As one example of many, different Intel and AMD processors have very different penalties for using unaligned SSE instructions, such as the _mm_storeu_ps C++ intrinsic.

    To learn the specifics of different processors, I’d recommend The microarchitecture of Intel, AMD and VIA CPUs: An optimization guide for assembly programmers and compiler makers. In fact, I’m just going to go ahead and recommend all of the optimization manuals from Agner Fog. Also, hardware vendors provide documentation for their particular hardware.

    Learning to Use Tools

    Having a good mental model of C++ and hardware performance is very useful when optimizing code. But, learning to use the right tools is at least as useful. Arguably the best advice for optimization is “Measure first!”. It is extremely difficult to understand the performance of even a simple block of code just by thinking about it. You’ll gain a lot of information by running the code and measuring it in various ways.

    These are some of the common useful measurements:

    • Timing: just run the code and measure the time
    • Sampling profilers
    • Instrumentation profilers
    • Processor counters

    I won’t get into recommendations for specific tools, since I am arguably getting out of scope of your original question. And, tooling is a big topic by itself: tools vary for different hardware platforms, software platforms, and by cost (some are free, some are expensive).

    But, you certainly need to be aware that to optimize C++ code, you need to know and use appropriate tools.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.