Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
I did some performance testing a couple years ago and in NMRiH the particular pain points I noticed were in Client_Animation, Shadow_Rendering (gets very expensive on high density displacements), and prop static rendering (likely largely due to high cost of draw calls). I never really pored through the game source code, however.
EDIT: Also, pass your string by const ref instead of copying it into the function.
I know XD I just did this just to test it out, didn't really put much effort into it.I also noticed I ran into a few case sensitivity issues due to the way our animations were named in the QC files, so you could use use std::transform to change the case to lower in that Init() function.
I'll see what I can do with showbudget and whatnot.
The reason why it had such an impact on the mod I work on is because we have custom player anim state code that calculates what animations we should use based on some things that happen during games.
Regardless though, that's not uncommon, and it still highlights that the performance of the lookup functions is rather bad. Props use it as well.
https://imgur.com/a/Pd3mn
That shows the budget difference. You can see the ConVar I change in the lower left. Depending on the map, the number of players (which I had filled the server with bots), and the prop animations, the difference can be as low as like 15 FPS or as high as over 100 FPS. And you can see the client animation budget was cut by 2/3. That's a lot.
Of course it is better to use a map/dictionary to do the lookups. You may want to consider using Source's own library functions though instead of the STL ones. CUtlDict should do the job.
In some other versions of the code pstudiohdr already supports a dictionary lookup and has its own LookupSequence function that does so.
This change won't significantly increase performance for most games/mods though.
But anyway, we have an implementation now that uses CUtlStringMap because our other active programmer is averse to using STL as well. Though it feels like it doesn't have the same performance impact as the STL version did.
Me I care less and less for the Valve C style the more I work in Source.
Source is an unholy mess that I love to hate, but also can't seem to stop working with. XD