nosoop / SM-TFAttributeSupport

A SourceMod plugin that improves support for official TF2 attributes.
GNU General Public License v3.0
12 stars 4 forks source link

Performance Issues when clients spawn / swap classes #8

Open kingofings opened 2 years ago

kingofings commented 2 years ago

I have mentioned this here nosoop/SM-TFCustAttr#9

To make it easier to keep track of I am opening this issue here.

The increase of cpu usage is basically the same as the core plugin from the issue above. Having the plugin loaded adds a noticeable amount of delay when you select a class which can (if done by multiple players) cause the server to rubberband for everyone.

As mentioned in the other repo this performance hit could see potential abuse.

nosoop commented 2 years ago

From what I can tell, most of the performance impact happens in DHookEntity (when the entity gets created, certain functions get hooked).

Not much I can do without changes to DHooks to support global hooks (which should also benefit a lot of code that hooks every entity), or a rearchitecture of the plugin to detour every implementation of a virtual function.

There's probably some opportunities for optimization in DHooks as well, without global hook support.

nosoop commented 1 year ago

012d64f0c5028177e8bbba8279741e3355926b5b changes the HasEntProp lookup to only be performed on weapons, which should alleviate performance issues specific to this plugin.