O'Reilly logo
  • Chris Kang thinks this is interesting:

C++ features that can impact the performance of your API are covered in this chapter. In general, you should not warp your API to achieve high performance; always measure performance and target any optimizations at actual bottlenecks. I describe the performance increases of passing arguments as const references and of reducing your #include dependencies. I show how naive constant declarations can add weight to your classes, and I explain why initialization lists are efficient and where you should declare them. I also spend a lot of time on memory optimizations so that your APIs map well to modern CPU caching strategies, including variable clustering, bit fields, unions, and size-based types. Because the use o...


Cover of API Design for C++


By wrapping, you're providing client with a new higher order API that calls many other API (i.e. one client call translates into many internal calls so that the client doesn't have to make all the detailed calls). This is not recommended. Each API should operate at peak performance. Having a wrapper API is not the best way to improve performance.