Raised This Month: $32 Target: $400
 8% 

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 , 17: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
__________________
My biggest Projects: Kigen AC Redux, Forlix Floodcheck Redux

Last edited by DJPlaya; 08-18-2019 at 06:13.
DJPlaya is offline
Send a message via Skype™ to DJPlaya
Farbror Godis
AlliedModders Donor
Join Date: Feb 2016
Old 08-17-2019 , 19: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 , 19: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 , 01: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 , 06:13   Re: GetConVar... every time its executed vs storing the Value
Reply With Quote #5

Thanks
#Closed
__________________
My biggest Projects: Kigen AC Redux, Forlix Floodcheck Redux
DJPlaya is offline
Send a message via Skype™ to DJPlaya
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 08-20-2019 , 05: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. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
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 01:31.


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