In an AI application I am writing in C++,
Have you actually profiled and found where, and what needs optimization?
Work on actually optimizing virtual function calls when you have found they actually are the bottleneck.