perf(smudge): Early return W3DSmudgeManager::render when no smudges are present - #3140
Conversation
PR Summary by Qodoperf(smudge): Skip W3DSmudgeManager::render work when no smudges exist
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1.
|
|
Another optimisation could be to move |
Perhaps but the hardware test only has a cost the first time and the result is cached afterward, and a benefit of this lazy check is that it can easily rerun after a device reset (actually it's not currently doing that, seems like a bug). |
Ah yes i see it now, the function is architected in an annoying way and could have had an early return. |
|
after DoParticles() returns, RTS3DScene::Flush() immediately calls SortingRendererClass::Flush() again. |
Yeah that sounds correct, so the expected performance gain is small (but every bit helps) |
In #2484 a global smudge set was introduced through which all smudge particles were rendered.
As a result there is always at least one smudge set in the list, which meant that
W3DSmudgeManager::renderwould always do some work before discovering there are no smudges in the set. This PR adds an early return to skip some of these calculations including a call toSortingRendererClass::Flush().Performance gain: ~7.5µs per frame
Todo