Optimize Lua timing profiler for #5240 - #5257
Merged
FileEX merged 1 commit intoAug 22, 2026
Merged
Conversation
…ating and O(1) direct accumulator - Replace std::map lookups with CFastHashMap in CClientPerfStatLuaTiming and CPerfStatLuaTiming - Add direct O(1) UpdateTimingFast accumulator for pre-cached timing blocks - Implement active profiler gating (IsActive) to bypass expensive clock queries (GetTimeUs) when profiler is inactive - Synchronize optimizations across both Client and Server performance modules
Member
|
This PR is the result of collaboration as part of #5240. I tested it together with the new event system and I'm getting around 90 FPS with 5K onClientRender handlers, whereas with the old profiler I was seeing FPS drops to around 40–50. The difference is huge. Since this PR has been tested in a real-world scenario, I believe it's mature enough to be merged. It could also have a positive impact on the current event system, potentially improving player FPS even before the new event system is introduced. |
FileEX
approved these changes
Aug 22, 2026
FileEX
enabled auto-merge (squash)
August 22, 2026 02:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Optimizes
CClientPerfStatLuaTimingandCPerfStatLuaTimingmodules to eliminate CPU throttling and framerate drops caused byUpdateLuaTiming.This PR is required by and resolves the performance bottleneck identified in #5240, where profiling frequent events under heavy handler load resulted in a 30–40 FPS drop. With these changes, the event system can profile handlers with zero impact during normal gameplay and minimal overhead when stats are polled.
Changes
Testing