Optimize AddMasteryEffectOptionsToNode, improve startup time #6607
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Improves startup time by about 400 ms.
AddMasteryEffectOptionsToNode was combining all mastery option mod lines into one node.sd and then calling ProcessStats which led to many mod lines being combined in an attempt to parse them. These combined lines shouldn't be combined for parsing since they come from different mastery options and they also weren't cached so parsing them was very slow.
This change adds a new startIndex parameter to ProcessStats so it can incrementally parse the mastery options as they are added by AddMasteryEffectOptionsToNode instead of parsing them all at once.
Also added new "Startup time: #### ms" print message that measures from start until the first OnFrame call finishes. I was measuring just Main:Init before but there is some init code in the first OnFrame call so now I'm measuring until end of first frame.
Steps taken to verify a working solution: