View Single Post
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-24-2010 , 13:21   Re: [HOWTO] Using XVars
Reply With Quote #8

It appears that get_pcvar_num and get_xvar_num are executed with the same speed.
fake natives are slower.

Plugins 1 :
PHP Code:
#include <amxmodx>

#define VERSION "0.0.1"
#define PLUGIN "xvar profile 1"

public xvar1 10

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
register_cvar("amx_cvar_test""1337")
}

public 
plugin_natives()
{
    
register_native("get_variable_test""get_variable_test")
}

public 
get_variable_test()
{
    return 
xvar1

Plugin 2 (profiled) :
PHP Code:
#include <amxmodx>

#define VERSION "0.0.1"
#define PLUGIN "xvar profile 2"

native get_variable_test()

public 
plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
}

public 
plugin_cfg()
{
    new 
pcvar get_cvar_pointer("amx_cvar_test")
    new 
xvar get_xvar_id("xvar1")

    for(new 
ii<1000i++)
    {
        
get_pcvar_num(pcvar)
        
get_xvar_num(xvar)
        
get_variable_test()
    }


Dump :
Code:
date: Fri Sep 24 19:18:23 2010 map: de_aztec
type |                             name |      calls | time / min / max
-------------------------------------------------------------------
   n |                  register_plugin |          1 | 0.000001 / 0.000001 / 0.000001
   n |                 get_cvar_pointer |          1 | 0.000001 / 0.000001 / 0.000001
   n |                      get_xvar_id |          1 | 0.000001 / 0.000001 / 0.000001
   n |                    get_pcvar_num |       1000 | 0.000180 / 0.000000 / 0.000000
   n |                     get_xvar_num |       1000 | 0.000179 / 0.000000 / 0.000000
   n |                get_variable_test |       1000 | 0.000245 / 0.000000 / 0.000001
   p |                       plugin_cfg |          1 | 0.000561 / 0.000561 / 0.000561
   p |                      plugin_init |          1 | 0.000001 / 0.000001 / 0.000001
0 natives, 0 public callbacks, 2 function calls were not executed.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 08-07-2011 at 04:57.
ConnorMcLeod is offline