Get the latest tech news

C++'s `noexcept` can sometimes help or hurt performance


ver the course of working on PSRayTracing (PSRT), I've been trying to find all sorts of tricks and techniques to squeeze out more performance from this C++ project. Most of it tends to be alternative algorithms, code rewriting, and adjusting data structures.

Second, the Standard Library is noexcept-aware and uses it to decide between copies, which are generally slow, and moves, which can be orders of magnitude faster, when doing common operations like making a vector bigger. The people who like noexcept might find this validating, but it's at odds with the tables from measuring PSRT: The speedups here aren't being matched with all the results from book 1, which uses the same "sequential search in std::vector" technique. As for the benchmark itself, I would have loved to throw in some Android and iOS runs as well, but I do not have the bandwidth for that, or infrastructure to make it possible unless I were to quit my day job.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Performance

Performance

Photo of help

help

Photo of C++

C++

Related news:

News photo

CrowdStrike unhappy about Delta's 'litigation threat,' claims airline refused 'free on-site help'

News photo

CrowdStrike Says Delta CEO Ignored Help Offer During Outage

News photo

The difference between undefined behavior and ill-formed C++ programs