perf(script): Reduce cost of ScriptEngine::findScript() by around 85% - #3096
perf(script): Reduce cost of ScriptEngine::findScript() by around 85%#3096Mauller wants to merge 1 commit into
Conversation
66da268 to
73f3c67
Compare
There was a problem hiding this comment.
const got a bit out of hand; use these:
const AsciiString& getName() const { return m_groupName;}
const AsciiString& getName() const { return m_scriptName;}
const AsciiString& getConditionTeamName() const {return m_conditionTeamName;}
Did removing the global lock from the AsciiString member functions provide less performance improvement than these changes? That'd be surprising to me.
|
I found one issue a few times, otherwise this looks good to me, and wow on the performance boost - great find :) btw potential follow-up after this merges: findScript/findGroup are still O(total scripts) linear scans across every side, called per lookup. Edit: Just noticed Caball had already found these - sorry for duplicating! |
Yeah, removing the global lock did provide less performance compared to passing references. The same happened with the waypoint and trigger labels fix. |
73f3c67 to
ef84147
Compare
|
Tweaked and ready to go, i have no idea why some checks are not running though. |
|
It probably detects you didn't make changes to the Generals code yet. |
I did not realise that change had been implemented. |
This PR dramatically improves script search performance by removing the allocation overhead when comparing script names.
I also tested the same performance degradation against a version of asciistring that does not use the global locks.
But like with the similar waypoint names fix #2761, returning constant references to the asciistrings was significantly more performant.
All of these tests were performed in a retail release, letting the same AoD map level run to its conclusion.
So this is not a debug only issue.
Flame graphs and function usage comparisons.
Before:


After:

video comparison.
This video shows the most recent GO build against a tweaked GO build with the fixes from this PR.
https://youtu.be/aDy8w4sHPKU
TODO