Raised This Month: $51 Target: $400
 12% 

Solved Questions: code execution time; nVault use optimization


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
E1_531G
Senior Member
Join Date: Dec 2017
Old 08-17-2018 , 16:53   Questions: code execution time; nVault use optimization
Reply With Quote #1

Hello.

I have 2 questions:
1. Suppose we have this code:
PHP Code:
public plugin_end()
{
   for(new 
1<= MAX_PLAYERSi++ )
       
someHeavyFunc(i)

The question is: Will the server wait untill all the code is executed? I mean, will the server wait all time that the code requires? (1 second, 5, 10, 10 minutes, ...)?

2. How does the nVault module look for an entry? I mean, how does it look at the keys?
The question is: Will saving using the ascending int as keys ("1", "2", ...) be more efficient than saving with keys based on players steam id?

Thank you all.
__________________
My English is A0

Last edited by E1_531G; 08-19-2018 at 04:47.
E1_531G is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-17-2018 , 17:04   Re: Questions: code execution time; nVault use optimization
Reply With Quote #2

1. Not sure what you meant, are you asking about whether the code that comes after the loop will execute before the loop has ended? If so, no.
PHP Code:
#include < amxmodx >

const iTo 1000000000000000000000000000000000000000000000000000000000000000000000;

public 
plugin_init( )
{
    new 
iFrom;

    static 
szTime10 ];
    
get_time"%r"szTimecharsmaxszTime ) );
    
    
log_to_file"Debug1.txt""Start time: %s"szTime );

    while( 
iFrom >= iTo )
    {
        
iFrom++;
    }

    
EmptyStringszTime );
    
get_time"%r"szTimecharsmaxszTime ) );
    
    
log_to_file"Debug1.txt""Finish time: %s"szTime );
}

EmptyStringszString[ ] )
szString] = EOS
Code:
Start time: 12:04:00 
Finish time: 12:04:04
__________________

Last edited by edon1337; 08-17-2018 at 17:05.
edon1337 is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 08-17-2018 , 17:32   Re: Questions: code execution time; nVault use optimization
Reply With Quote #3

1. Server will wait until your code will be executed fully
2. No matters there will be very tiny difference cause nVault uses string hashmap.

@edon1337, well that number is very big but it wont really execute as much, such number does not exist in system, in pawn scripting max number is C++ integer number which is 2,147,483,647 and minimum is -2,147,483,648
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM
Ghosted is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-17-2018 , 17:53   Re: Questions: code execution time; nVault use optimization
Reply With Quote #4

Quote:
Originally Posted by Ghosted View Post
1. Server will wait until your code will be executed fully
2. No matters there will be very tiny difference cause nVault uses string hashmap.

@edon1337, well that number is very big but it wont really execute as much, such number does not exist in system, in pawn scripting max number is C++ integer number which is 2,147,483,647 and minimum is -2,147,483,648
My point was to make it as long as I could, since I didn't know of this maximum num.
__________________

Last edited by edon1337; 08-17-2018 at 17:56.
edon1337 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 08-17-2018 , 18:01   Re: Questions: code execution time; nVault use optimization
Reply With Quote #5

Code:
const iTo = cellmax
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
E1_531G
Senior Member
Join Date: Dec 2017
Old 08-18-2018 , 08:29   Re: Questions: code execution time; nVault use optimization
Reply With Quote #6

Quote:
2. No matters there will be very tiny difference cause nVault uses string hashmap.
So, to find the key "2" and find the key "STEAM_X:X:XXXXXX" will take the same time?
__________________
My English is A0
E1_531G is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 08-18-2018 , 10:58   Re: Questions: code execution time; nVault use optimization
Reply With Quote #7

The difference is so tiny you can consider it being the same, yes.
__________________
klippy is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 08-19-2018 , 04:47   Re: Questions: code execution time; nVault use optimization
Reply With Quote #8

Thank you all.
Solved.
__________________
My English is A0
E1_531G is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:18.


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