Repository navigation
[WONTFIX?] Read mp_slammoveyaw directly in the 9-way move yaw - #2237
Draft
sunzenshen wants to merge 2 commits into
Draft
sunzenshen wants to merge 2 commits into
sunzenshen wants to merge 2 commits into
Conversation
CHL2MPPlayerAnimState::ComputePoseParam_MoveYaw built a ConVarRef by name on every call, so every player's every usercmd on the server (and every frame on the client) did a linear CCvar::FindVar walk over all registered cvars. The ConVar is defined in multiplayer_animstate.cpp, which both DLLs compile, so refer to it with extern instead. The value read is the same; only the lookup goes away. Co-authored-by: Mikhail Bogdanov <Masterkatze@users.noreply.github.com>
Keep the stock SDK code path unchanged outside NEO builds: only NEO reads the ConVar directly, other builds keep the by-name lookup.
Contributor
|
wowee like +50 fps on isolation with 22 bots (edit) well the fps counter is difficult to read, 50 fps might be a bit much but definitely a significant improvement |
Contributor
|
also no ifdef NEOs, but I understand this is a draft pr and imagine you will want to move this into neoplayeranimstate anyway |
Contributor
Author
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.
Description
CHL2MPPlayerAnimState::ComputePoseParam_MoveYawbuildsConVarRef mp_slammoveyaw("mp_slammoveyaw")on every call. Each construction looks the cvar up by name withCCvar::FindVar, a linear, case-insensitive walk over every registered cvar. The function runs for every player on every usercmd on the server, and every frame for every player on the client, so this one lookup was the largest single cost in a bot match's server frame.mp_slammoveyawis defined inshared/Multiplayer/multiplayer_animstate.cpp, which both the client and the server build, and that file already reads it directly. This PR declares itexternand drops theConVarRef; themp_slammoveyaw.GetBool()line is unchanged. The value read is the live cvar value, as before: nothing is cached, so changing the cvar still takes effect at once.Masterkatze identified this lookup cost earlier (unmerged "Cache mp_slammoveyaw" on their fps branch); this version reads the live cvar value instead of caching it once.
How to test
mp_slammoveyaw 1(development-only cvar) still snaps the move yaw while moving;mp_slammoveyaw 0turns it off again.Risk
None expected: same ConVar object, same value, no behavior change.
ConVar::GetBoolreads the parent ConVar's value, and the parent is the oneFindVarreturned.Results
Linux dedicated server, Release builds of master (f426c22) with and without this commit, both with the test harness's match markers and a temporary timer around
ComputePoseParam_MoveYaw(including its base class call) and aroundCServerGameDLL::GameFrame. 15 CTG matches per build (ntre_transit_ctg,ntre_rise_ctg,ntre_threadplate_ctg, one per ghost spawn), 30 bots, 1 round, builds interleaved:ComputePoseParam_MoveYaw, per callA
perfprofile of the same setup on an earlier master (0707264) putConVarRef::ConVarRef/CCvar::FindVarunderComputePoseParam_MoveYawat 13.8-16.4 % of server CPU. The client compiles and runs the same code per frame per player; it was built but not timed.All 30 matches ended normally with no asserts, and 3 matches on a Debug build (one per map, 30 bots) had no asserts.