View Single Post
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 04-20-2009 , 04:44   Re: [INFO] Bitsums and Operators
Reply With Quote #7

Quote:
Originally Posted by Empowers View Post
Wow thx for Great TUT!


Profiled:

Code:
date: Sun Apr 19 15:20:28 2009 map: de_dust
type |                             name |      calls | time / min / max
-------------------------------------------------------------------
   n |                   register_clcmd |          2 | 0.000019 / 0.000004 / 0.000015
   p |                       array_test |         10 | 0.064196 / 0.006202 / 0.006642
   p |                      bitsum_test |         10 | 0.029594 / 0.002811 / 0.003570
   p |                      plugin_init |          1 | 0.000002 / 0.000002 / 0.000002
0 natives, 0 public callbacks, 3 function calls were not executed.
Tested on this code:
PHP Code:
#include <amxmodx>

new array[33]
new 
bitsum

public plugin_init() 
{
    array[
32] = false
        
    bitsum 
&=  ~(1<<32
    
    
register_clcmd("array","array_test")
    
register_clcmd("bitsum","bitsum_test")
}

public 
bitsum_test()
{
    for(new 
i;i<=1_000_000;i++)
        if(
bitsum & (1<<32))
            continue;
}

public 
array_test()
{
    for(new 
i;i<=1_000_000;i++)
        if(array[
32])
            continue;

Now I'm thinking should I swap arrays with bitsums in my plugins code. It would use less memory, but it will be harder to understand the code.
__________________
joaquimandrade is offline