2013

  • December 6, 2013

    For public API methods, good programming practice recommends always checking incoming arguments for validity before using them. When a problem is found, code may return an error code, throw an exception, or abort with an assert. But when the arguments are valid, what is the runtime cost of this checking? Does declaring that a method can throw an exception slow down the method even if one isn't thrown? This article does quick benchmarking to look at some runtime costs associated with argument checking, exceptions, and asserts.

  • November 4, 2013

    The C++ "inline" keyword marks methods as inlineable by the compiler to improve performance. But today's compilers seem to inline methods even if they aren't marked with "inline". So is there a need for the "inline" keyword? This article does quick benchmarking of multiple ways to define method bodies, with and without "inline", to see if there's any value to the keyword.

  • October 1, 2013

    Object-oriented design favors class hierarchies with general base classes and specific subclasses. Virtual methods provide general implementations on the base class, overridden for specific implementations by subclasses. But how does this coding style affect runtime performance? This article does a quick benchmark to illustrate the cost of "virtual" on a method.

Syndicate content
Nadeau software consulting
Nadeau software consulting