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

[INCLUDE] AutoExecConfig: Read and append to auto configs


Post New Thread Reply   
 
Thread Tools Display Modes
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 12-07-2013 , 18:09   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #31

Like i told you in the updater thread, it's not easy to change or remove stuff because the format cannot be relyed upon.
The default value could be changed in theory, but there is a reason this isn't implemented, think about someone who relies upon it being the same value after an update.
I don't plan to add any new complex functionality besides bugfixes, but feel free to send me an pull request if you want.

Quote:
Originally Posted by Bittersweet View Post
not even the version.
A plugin version cvar shouldn't be in a cfg file.
__________________

Last edited by Impact123; 12-07-2013 at 18:16.
Impact123 is offline
Bittersweet
Veteran Member
Join Date: May 2012
Old 12-07-2013 , 18:37   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #32

Quote:
Originally Posted by Impact123 View Post
Like i told you in the updater thread, it's not easy to change or remove stuff because the format cannot be relyed upon.
The default value could be changed in theory, but there is a reason this isn't implemented, think about someone who relies upon it being the same value after an update.
I don't plan to add any new complex functionality besides bugfixes, but feel free to send me an pull request if you want.


A plugin version cvar shouldn't be in a cfg file.
Right, I was just using that as a test, which was a bad choice. But it doesn't matter, this only adds new cvars, and does preserve values for existing cvars. It doesn't remove unused cvars, or update any of the changed default values, descriptions, etc.

This is very nice, and I'll use it, but I still need to implement my code anyway. Some folks had suggested this did the same thing. It doesn't.
__________________
Thank you in advance for your help

My plugins:
[CS:S] BOT Swat | [ANY] CVAR Randomizer | [CS:S] SM CS:S Tag Beta | [CS:S] Bot2Player
Awesome & Crucial plugins by other people:
[CS:S/CS:GO] GunGame | [UMC3] Ultimate Mapchooser | [ANY] Server Crontab | [ANY] SM ForceCamera
Bittersweet is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 04-07-2015 , 20:21   Re: [INCLUDE] Autoexecconfig read and append beta
Reply With Quote #33

I thought i let you know that TheChineese just ported the include file to the 1.7 syntax. You don't have to use the view_as operator anymore in your 1.7.* code.
If, for whatever reason, you currently can't use the 1.7.* compiler for your project, the last non 1.7 code can be found here.
__________________

Last edited by Impact123; 04-07-2015 at 20:26.
Impact123 is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 04-08-2015 , 02:51   Re: [INCLUDE] AutoExecConfig: Read and append to auto configs
Reply With Quote #34

Thank you
__________________
View my Plugins | Donate
TnTSCS is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 07-28-2015 , 01:42   Re: [INCLUDE] AutoExecConfig: Read and append to auto configs
Reply With Quote #35

I just added convar caching to the include. I'm not really satisfied with the amount of duplicate code and I've only tested this very briefly (it shows), hence it's in the development branch, but it shouldn't break anything unless you use the added function. In my tests this method reduced the overall time it took to run the test script, which can be found here, by 50~%. This will, of course, only work after the config was created the first time.

The way this works is relatively simple, you use it like this
PHP Code:
// Call anywhere after AutoExecConfig_SetFile but before using AutoExecConfig_CreateConVar
AutoExecConfig_CacheConvars(); 
This will read the whole config and store everything within which looks like a valid convar in a trie. It will also toggle a switch which tells the AutoExecConfig_FindValue function (which is internally used by AutoExecConfig_CreateConvar) to use this trie instead of reading whole the config file and searching it within.
If you could test this and and let me know what you think, that would be great.
__________________

Last edited by Impact123; 07-28-2015 at 02:42.
Impact123 is offline
headline
SourceMod Moderator
Join Date: Mar 2015
Old 07-28-2015 , 12:26   Re: [INCLUDE] AutoExecConfig: Read and append to auto configs
Reply With Quote #36

Quote:
Originally Posted by Impact123 View Post
I just added convar caching to the include. I'm not really satisfied with the amount of duplicate code and I've only tested this very briefly (it shows), hence it's in the development branch, but it shouldn't break anything unless you use the added function. In my tests this method reduced the overall time it took to run the test script, which can be found here, by 50~%. This will, of course, only work after the config was created the first time.

The way this works is relatively simple, you use it like this
PHP Code:
// Call anywhere after AutoExecConfig_SetFile but before using AutoExecConfig_CreateConVar
AutoExecConfig_CacheConvars(); 
This will read the whole config and store everything within which looks like a valid convar in a trie. It will also toggle a switch which tells the AutoExecConfig_FindValue function (which is internally used by AutoExecConfig_CreateConvar) to use this trie instead of reading whole the config file and searching it within.
If you could test this and and let me know what you think, that would be great.
Im sorry I dont understand. Why would I use this?
headline is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 07-28-2015 , 13:41   Re: [INCLUDE] AutoExecConfig: Read and append to auto configs
Reply With Quote #37

Well, to get the benefit of a cache, performance, which is crucial on a game server
__________________

Last edited by Impact123; 07-28-2015 at 13:54.
Impact123 is offline
headline
SourceMod Moderator
Join Date: Mar 2015
Old 07-28-2015 , 14:28   Re: [INCLUDE] AutoExecConfig: Read and append to auto configs
Reply With Quote #38

Quote:
Originally Posted by Impact123 View Post
Well, to get the benefit of a cache, performance, which is crucial on a game server
Hm okay!
headline is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-28-2015 , 16:51   Re: [INCLUDE] AutoExecConfig: Read and append to auto configs
Reply With Quote #39

Quote:
Originally Posted by Impact123 View Post
Well, to get the benefit of a cache, performance, which is crucial on a game server
...and you think a StringMap lookup is going to be quicker than just grabbing the default value of the ConVar directly?

Have you profiled this?
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 07-28-2015 at 16:53.
Powerlord is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 07-28-2015 , 17:07   Re: [INCLUDE] AutoExecConfig: Read and append to auto configs
Reply With Quote #40

No, but it's faster than reading the autoexecconfig file. A convar's value isn't useful in finding out if the convar exists in this file.
__________________

Last edited by Impact123; 07-28-2015 at 17:17.
Impact123 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 08:34.


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