In an AI application I am writing in C++,
- there is not much numerical computation
- there are lot of structures for which run-time polymorphism is needed
- very often, several polymorphic structures interact during computation
In such a situation, are there any optimization techniques? While I won't care to optimize the application just now, one aspect of selecting C++ over Java for the project was to enable more leverage to optimize and to be able to use non-object oriented methods (templates, procedures, overloading).
In particular, what are the optimization techniques related to virtual functions? Virtual functions are implemented through virtual tables in memory. Is there some way to pre-fetch these virtual tables onto L2 cache (the cost of fetching from memory/L2 cache is increasing)?
Apart from this, are there good references for data locality techniques in C++? These techniques would reduce the wait time for data fetch into L2 cache needed for computation.
Update: Also see the following related forums: Performance Penalty for Interface, Several Levels of Base Classes