News for hackers. Stuff that matters.
Re:Orthodox C++ by arcticbull on Sunday December 27, 2020 @07:46PM (#25555630)
Generated code has a cost in terms of size, of course, and in terms of performance via the addition of branching, branch mis-prediction penalty and decreased cache locality. This function invocation will also of course flush the pipeline and harm inlining. On a hot path this could be non-trivial.
Re:Orthodox C++ by kllrnohj on Sunday December 27, 2020 @08:08PM (#25555769)
While true it's also fewer branches than manual error handling via return values.

So the only "fast" option is to just not handle errors at all. Which is a terrible recommendation, of course.

Re:Orthodox C++ by alisonkisk on Monday December 28, 2020 @08:09AM (#25558922)
That not the point, though. The point is that the cost is invisible with exceptions. For example, there could perhaps be an alternate version of C++ where every function is required to declare whether it could throw an exception (and a very smart compiler proves where it's possible), or that -fno-except flag is inverted so you have to opt in to exceptions.
Re:Orthodox C++ by jcelerier on Monday December 28, 2020 @08:30AM (#25559035)
you still have branches with noexcept, the difference is that they call std::terminate in case of stack unwinding.