Raised This Month: $153 Target: $400
 38% 

Solved GetConVar... every time its executed vs storing the Value


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DJPlaya
Senior Member
Join Date: Nov 2014
Location: Germany
Old 08-17-2019 , 18:00   GetConVar... every time its executed vs storing the Value
Reply With Quote #1

I know this is a bit dump but i am always trying to optimize my Plugins till the impossibility.
So what do you believe is more Ressource intensive, using GetConVar... every time its needed or storing the Value in a Var.
I dont know how Resource intensive it is to Read the Handle so i cant really judge
__________________
Free hosting 4 interesting Projects

Last edited by DJPlaya; 08-18-2019 at 07:13.
DJPlaya is offline
Send a message via Skype™ to DJPlaya
Farbror Godis
AlliedModders Donor
Join Date: Feb 2016
Old 08-17-2019 , 20:39   Re: GetConVar... every time its executed vs storing the Value
Reply With Quote #2

As you said this is probably such a small difference that it is barely measurable.. But generally caching (that is, storing it in a variable) is faster, don't see why it would be any different in sourcemod..
__________________
Farbror Godis is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 08-17-2019 , 20:45   Re: GetConVar... every time its executed vs storing the Value
Reply With Quote #3

Sourcemod does its own caching. There is 0 performance difference between caching and not caching cvars on the plugin's end of things.
__________________
ddhoward is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 08-18-2019 , 02:08   Re: GetConVar... every time its executed vs storing the Value
Reply With Quote #4

Just besure to cache FindConVar if you're using it in something that loops etc. But you don't really need to store it if you're only changing it if it changes or on mapstart.
__________________
Mitchell is offline
DJPlaya
Senior Member
Join Date: Nov 2014
Location: Germany
Old 08-18-2019 , 07:13   Re: GetConVar... every time its executed vs storing the Value
Reply With Quote #5

Thanks
#Closed
__________________
Free hosting 4 interesting Projects
DJPlaya is offline
Send a message via Skype™ to DJPlaya
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine
Old 08-20-2019 , 06:21   Re: GetConVar... every time its executed vs storing the Value
Reply With Quote #6

Just use methodmaps
__________________
Expert of CMD/VBS/VB6. Malware analyst.
[My plugins] [My tools] [GitHub]
Dragokas is offline
Reply


Thread Tools
Display Modes

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 10:17.


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