AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   benchmark/profiling entity_range() and get_distance_f() with cached origins (https://forums.alliedmods.net/showthread.php?t=89126)

SchlumPF* 04-02-2009 15:37

benchmark/profiling entity_range() and get_distance_f() with cached origins
 
can someone pls benchmark this code? i cant cuz my cs is crashing with both profiling binarys :(

PHP Code:

#include <amxmodx>
#include <engine>
#include <fakemeta>

#define TESTS 100000

public plugin_init( )
{
    
register_clcmd"say /test1""cmdTest1" );
    
register_clcmd"say /test2""cmdTest2" );
}

public 
cmdTest1plr )
{
    new 
Float:distance;
    
    for( new 
iTESTSi++ )
    {
        
distance entity_rangeplr);
    }
}

public 
cmdTest2plr )
{
    new 
Float:distance;

    new 
Float:origin1[3], Float:origin2[3];
    
pevplrpev_originorigin1 );
    
pev2pev_originorigin2 );
    
    for( new 
iTESTSi++ )
    {
        
distance get_distance_forigin1origin2 );
    }



ConnorMcLeod 04-02-2009 16:00

Re: benchmark/profiling entity_range() and get_distance_f() with cached origins
 
PHP Code:

public cmdTest1plr )
{
    new 
entmaxents global_getglb_maxEntities )
    for(
ent get_maxplayers()+1ent<maxentsent++)
    {
        if( 
pev_valid(ent) )
        {
            break
        }
    }

    new 
Float:origin1[3], Float:origin2[3];
    
pevplrpev_originorigin1 );
    
peventpev_originorigin2 );

    for( new 
iTESTSi++ )
    {
        
entity_rangeplrent );
        
get_distance_forigin1origin2 )
    }


Code:

date: Thu Apr 02 21:58:59 2009 map: de_dust2
type |                            name |      calls | time / min / max
-------------------------------------------------------------------
  n |                  register_clcmd |          1 | 0.000004 / 0.000004 / 0.000004
  n |                      global_get |          1 | 0.000001 / 0.000001 / 0.000001
  n |                  get_maxplayers |          1 | 0.000000 / 0.000000 / 0.000000
  n |                        pev_valid |          1 | 0.000001 / 0.000001 / 0.000001
  n |                              pev |          2 | 0.000002 / 0.000000 / 0.000001
  n |                    entity_range |    100000 | 0.022782 / 0.000000 / 0.000086
  n |                  get_distance_f |    100000 | 0.021839 / 0.000000 / 0.000060
  p |                        cmdTest1 |          1 | 0.038927 / 0.038927 / 0.038927
  p |                      plugin_init |          1 | 0.000001 / 0.000001 / 0.000001
0 natives, 0 public callbacks, 2 function calls were not executed.


SchlumPF* 04-02-2009 16:56

Re: benchmark/profiling entity_range() and get_distance_f() with cached origins
 
thx :D


All times are GMT -4. The time now is 02:17.

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