I was walking through the callstacks and found that there is a LOT of checks in View::UpdateGeometries that do little. It is a fairly cheap function overall compared to the overall callstack, but adding a few more cache’s (or maybe an Event or two depending on how fast that call process is) could cut out a lot of the tests. Specially in my scene I am noticing on line 1179 the loop of for (unsigned i = 0; i < renderPath_->commands_.Size(); ++i)
are testing all of the renderPaths for if (!IsNecessary(command))
and if (command.type_ == CMD_SCENEPASS)
, wouldn’t it be better to have a dedicated cache/vector for the ones that fullfill these that are updated as necessary instead of looping? This one overall is trivial though, the big one that had a lot of hits on my scene was on line 1219 the loop of for (PODVector<Drawable*>::Iterator i = geometries_.Begin(); i != geometries_.End(); ++i)
loops over all geometries, of which there are quite a lot, but it just tests for either if (type == UPDATE_MAIN_THREAD)
or else if (type == UPDATE_WORKER_THREAD)
, yet all of them in my scene are UPDATE_NONE, so it is looping needlessly.
Just a notice I had, it is still very little time compared to, say, just clearing the screen, but it looks like a simple optimization that could potentially give a noticeable boost, though tests would say for sure instead of just guessing.