There are many things you can do to optimize C++ code. Some of the broader suggestions are listed above.
A couple specific examples are:
- Using Structs of Arrays as opposed to Array of Structs (Classic example of DOP vs OOP)
- Using restrict in C++ when you know two pointers will not point to the same memory location
In general, following a fundamental programming paradigm such as Data Oriented Programming will yield higher performance as DOP is specifically formulated to focus on performance (in all forms: memory layouts, cache coherency, runtime costs, etc.)
More info here: https://people.cs.clemson.edu/~dhouse/courses/405/papers/optimize.pdf