Refactor ModelPropertyContainer::m_vValues from vector to unordered_map#1302
Refactor ModelPropertyContainer::m_vValues from vector to unordered_map#1302Biendeo wants to merge 1 commit intoRetroAchievements:masterfrom
Conversation
|
Oddly enough, the data structure was changed from an While this solution may have marginal benefits for your specific set when using the DLL, most players won't be using the DLL and this change won't benefit them at all. This bottleneck should be handled by not scanning all of the assets every frame. Instead, a collection of assets with their "Pause on X" behaviors enabled should be maintained across frames. I have already put an item in my backlog to address that. |
|
I had to remind myself of this; I agree with where you want to take this though, the less overhead per-frame, especially for things that haven't changed between frames, the better the performance. 👍 |
|
Please try out the changes in #1304. |
With the Wii rollout, large sets such as the Super Smash Bros. Brawl and Guitar Hero: Warriors of Rock sets have noticed significant performance overheads for people on weaker machines. While it's expected to find these limits in places, is there any performance we can claw back for sets of this size?
In this PR, I've spotted that when benchmarking demo gameplay in Guitar Hero Warriors of Rock, 6.23% of the total processing time is spent in
ra::services::PrepareForPauseOnChangeEvents(), and in particularra::data::ModelPropertyContainer::FindValue(), which is callingstd::lower_bound()over avectoriterator to binary search for a corresponding value. Just eyeballing, thisvectoris often 11 or 12 elements large in this example.This PR replaces this
vectorwith anunordered_mapwhich benefits from an O(1) access complexity, and has shrunk the cost ofra::services::PrepareForPauseOnChangeEvents()to 4.81% of the overall processing time. In practise this should result in an unnoticeable change in performance for smaller sets, but gets about 2-3% more performance in these larger sets.