View Single Post
Empowers
BANNED
Join Date: Feb 2009
Location: Ukraine
Old 04-19-2009 , 08:04   Re: [INFO] Bitsums and Operators
Reply With Quote #2

Wow thx for Great TUT!
Quote:
Originally Posted by ot_207 View Post
So less memory usage!
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.

Last edited by Empowers; 04-19-2009 at 11:00.
Empowers is offline
Send a message via ICQ to Empowers