Aussie AI

Medium-Sized Slugs

  • Book Excerpt from "Generative AI in C++"
  • by David Spuler, Ph.D.

Medium-Sized Slugs

There are a lot more examples of possible inefficiencies in C++ coding. Some of the types of errors that are “medium-sized” slugs include:

  • Automatic array initializations with constant data.
  • Loop test function calls (ie. expensive loop conditional tests).
  • Member initializations in the constructor body (they should be in the initializer lists).
  • Program startup hidden initializations (global or static object constructors).
  • Small non-inline functions called frequently.
  • Busy wait loops.
  • Unnecessary code inside loops.
  • C++ classes wrapping simple data types (e.g. overuse of “smart pointers” or “smart integer” classes).
  • Overuse of standard string concatenation operations.
  • Recursion is almost always a slug.

 

Next:

Up: Table of Contents

Buy: Generative AI in C++: Coding Transformers and LLMs

Generative AI in C++ The new AI programming book by Aussie AI co-founders:
  • AI coding in C++
  • Transformer engine speedups
  • LLM models
  • Phone and desktop AI
  • Code examples
  • Research citations

Get your copy from Amazon: Generative AI in C++