‹ BackHN Continuity

Thread

Writing Efficient C++ Code (2013)

176 points · 161 comments · ibobev

  1. MaxBarraclough · · focus · HN ↗
    There's no mention of branch prediction, or context switching, or synchronisation. Depending on what you're doing, they could be very consequential. There's only very brief mention of parallelisation with threads and with SIMD.

    High-performance programming is a big topic. The scope is far too broad for a single blog post, which naturally gives only cursory discussion of C++ and computer architecture. The article isn't bad considering, but I do think it's the wrong format. A blog series, or even a book, would be more fitting.

    1. Jeaye · · focus · HN ↗
      Do you have any recommended essential reading for this?
      1. MaxBarraclough · · focus · HN ↗
        I'm no expert in this stuff but:

        creata's comment [0] mentions the works of Agner Fog, which seem very good, and are freely available.

        I haven't read C++ High Performance [1] but it looks like it covers the sorts of topics you'd expect, although it looks like it doesn't cover computer architecture in detail e.g. branch prediction. There are books on that too, of course.

        [0] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=49868657">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=49868657

        [1] <a href="https:&#x2F;&#x2F;www.packtpub.com&#x2F;en-us&#x2F;product&#x2F;c-high-performance-9781839212581" rel="nofollow">https:&#x2F;&#x2F;www.packtpub.com&#x2F;en-us&#x2F;product&#x2F;c-high-performance-97...

        1. blux · · focus · HN ↗
          I have read &#x27;C++ High Performance&#x27;, and I recommend to avoid it unless you are interested in reading an STL reference guide with only minimum hints on performance sprinkled in left and right. Or unless you do not know that `std::move` will avoid a copy in some cases, etc.

          In short, overpromises, underdelivers.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.