Raised This Month: $51 Target: $400
 12% 

Stocks vs Natives and Events vs Forwards


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DeepLearning
Junior Member
Join Date: Dec 2017
Old 08-16-2018 , 17:26   Stocks vs Natives and Events vs Forwards
Reply With Quote #1

Stocks vs Natives:
Way 1:
Include stock "FindClientBySteamID" in up to 20 plugins.
Way 2:
Make 1 plugin and expose "FindClientBySteamID Native".

Events vs Forwards:
Way 1:
Hook required event for every plugin.
Way 2:
Make Forwards for most common events, and use them in every suitable plugin.

Which way to go for stability and performance?
Thanks!
DeepLearning is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 08-16-2018 , 17:31   Re: Stocks vs Natives and Events vs Forwards
Reply With Quote #2

Stocks vs Natives

A native to expose a pawn function would use a few more CPU cycles. The difference is not worth while unless your call it thousands of times in a frame.

An advantage of a native is, if you update the functions code you dont have to recompile every plugin using the function.

Events vs Forwards

Same difference. Not really sure on performance but I beleive it's not even worth going for one over the other for performance.
__________________

Last edited by Neuro Toxin; 08-16-2018 at 17:34.
Neuro Toxin is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 08-16-2018 , 18:18   Re: Stocks vs Natives and Events vs Forwards
Reply With Quote #3

The only time I would personally use a native in 1 plugin over a stock in multiple plugins is when I'm collecting data set by the main plugin that I will use in the other plugins.

If you want to go with the stock route, just use an include file so all plugins can access the same function without exposing it as a native.

Regarding events, I would have to agree with Neuro Toxin. Calling forwards through events isn't all that different from hooking the same events in each plugin.
__________________
Psyk0tik is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:26.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode