AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   SMLIB 0.11 BETA (over 300 Function Stocks) | updated 15.07.2011 (https://forums.alliedmods.net/showthread.php?t=148387)

zeroibis 02-11-2011 15:53

Re: SMLIB 0.9.7 BETA (295 Function Stocks) | updated 08.02.2011
 
1 Attachment(s)
Was wondering if your php script at: http://www.sourcemodplugins.org/smlibfunctions.php

Could be used to make it easier to read other include files like the one attached?

berni 02-11-2011 16:03

Re: SMLIB 0.9.7 BETA (295 Function Stocks) | updated 08.02.2011
 
This was just a quick & dirty thing.
I have written a much more powerful Pawn Parser that I maybe will release together with the dynamic API documention, don't know yet :3

zeroibis 02-11-2011 19:33

Re: SMLIB 0.9.7 BETA (295 Function Stocks) | updated 08.02.2011
 
Ah, cool. Yea I have been trying to find a better way to see the list of natives and descriptions for that mod so that I and others can have an easier time writing programs for it.

bl4nk 02-25-2011 00:08

Re: SMLIB 0.9.7 BETA (295 Function Stocks) | updated 08.02.2011
 
Handles to convars don't need to be closed, as you're not making a new one when you find a convar.

berni 02-25-2011 07:22

Re: SMLIB 0.9.7 BETA (295 Function Stocks) | updated 08.02.2011
 
Quote:

Originally Posted by bl4nk (Post 1423303)
Handles to convars don't need to be closed, as you're not making a new one when you find a convar.

? doesn't Sourcemod create a new Handle for each call to FindConVar ?

psychonic 02-25-2011 08:17

Re: SMLIB 0.9.7 BETA (295 Function Stocks) | updated 08.02.2011
 
Quote:

Originally Posted by berni (Post 1423445)
? doesn't Sourcemod create a new Handle for each call to FindConVar ?

noOnly if SM did not already have a handle for that convar, but there will still only be one handle at most per convar.

Citation: http://hg.alliedmods.net/sourcemod-c...nager.cpp#l451

berni 02-25-2011 08:21

Re: SMLIB 0.9.7 BETA (295 Function Stocks) | updated 08.02.2011
 
Quote:

Originally Posted by psychonic (Post 1423460)
noOnly if SM did not already have a handle for that convar, but there will still only be one handle at most per convar.

ok thx then, I will also cache the handle, since calls to FindConVar are very expensive, I have also added caching to the team edict functions already.

If I get everything done I have in my head, I will make a bigger release today, including extensive chat color support.

bl4nk 02-25-2011 16:33

Re: SMLIB 0.9.7 BETA (295 Function Stocks) | updated 08.02.2011
 
Quote:

Originally Posted by berni (Post 1423463)
ok thx then, I will also cache the handle, since calls to FindConVar are very expensive, I have also added caching to the team edict functions already.

SM already does this (see the link psychonic posted), so there's no reason for you to do it in Pawn, which is slower than C++.

berni 02-25-2011 16:39

Re: SMLIB 0.9.7 BETA (295 Function Stocks) | updated 08.02.2011
 
Quote:

Originally Posted by bl4nk (Post 1423620)
SM already does this (see the link psychonic posted), so there's no reason for you to do it in Pawn, which is slower than C++.

In my tests this was not the case, I called FindConVar on a srcds convar 100.000 times and the profiling time was significantly higher than when it was cached.

psychonic 02-25-2011 17:35

Re: SMLIB 0.9.7 BETA (295 Function Stocks) | updated 08.02.2011
 
Quote:

Originally Posted by bl4nk (Post 1423620)
SM already does this (see the link psychonic posted), so there's no reason for you to do it in Pawn, which is slower than C++.

Quote:

Originally Posted by berni (Post 1423625)
In my tests this was not the case, I called FindConVar on a srcds convar 100.000 times and the profiling time was significantly higher than when it was cached.

Creating the handle to the convar isn't the slow part; finding the var is.

SM calls FindVar to first make sure the convar exists before looking to see if it already has a handle to it. FindVar iterates through all cvars and commands, doing string compares.

This is why it is slow even if SM already has a handle to it, and thus, why you should still cache the handle.


All times are GMT -4. The time now is 21:59.

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