alexguirre / RAGENativeUI

MIT License
115 stars 38 forks source link

Use NativeFunction.Natives to call ENABLE_CONTROL_ACTION etc. #28

Closed LSPDFR-PeterU closed 6 years ago

LSPDFR-PeterU commented 6 years ago

As of RagePluginHook 0.60, (possibly 58/59 as well), calling natives using NativeFunction.CallByName<return_type> appears to be 3-4 times slower than calling them using the new calling convention NativeFunction.Natives.NATIVE_NAME<return_type>.

This manifests itself in poor framerate whenever a RNUI menu is open. My analysis suggests that the time is lost here in DisEnableControls() during its calls to ENABLE_CONTROL_ACTION and DISABLE_CONTROL_ACTION.

In my testing, refactoring this method to use the new calling convention improves the framerate significantly. (Presumably, there are other places where RNUI calls natives that may also be affected).