Raised This Month: $ Target: $400
 0% 

[Solved] Optimize code


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 04-29-2011 , 20:15   [Solved] Optimize code
Reply With Quote #1

i Have this array:
c{ new _:RoundData[ MAXPLAYERS ][ MAXPLAYERS ][ 32 ][ 9 ][ Score ][ 3 ] };
and i want to take each entry from inside and to upload it into a mysql server
well i make a code but only in the compilation took 11 Seconds so i just don't want to thing how much time will take on server
Anyway to Optimize it?
this is the code:
Code:
for (new i=1;i<= g_iNumPlayers + g_subs; i++) {         for (new a=1;a<= g_TeamAScore + g_TeamBScore;a++) {             for (new p=1;p<= g_iNumPlayers + g_subs;p++) {                 if (i != p) {                     for (new k=0;k < 32;k++) {                         for (new z=0;z < 9;z++) {                             if (d{RoundData[ i ][ p ][ k ][ z ][ Kills ][ a ]}) {                                 format( szQuery, 900,"INSERT INTO `stats_roundstats` VALUES ('%d', '%s', '%d', '1', '0', '0', '%s','%d','%d');",g_id,g_player[i],a,g_player[p],k,z)                                 query = SQL_PrepareQuery( g_DB, szQuery );                                 SQL_Execute( query )                             }                             else if (d{RoundData[ i ][ p ][ k ][ z ][ Deaths ][ a ]}) {                                 format( szQuery, 900,"INSERT INTO `stats_roundstats` VALUES ('%d', '%s', '%d', '0', '1', '0', '%s','%d','%d');",g_id,g_player[i],a,g_player[p],k,z)                                 query = SQL_PrepareQuery( g_DB, szQuery );                                 SQL_Execute( query )                             }                             else if (d{RoundData[ i ][ p ][ k ][ z ][ Tks ][ a ]}) {                                 format( szQuery, 900,"INSERT INTO `stats_roundstats` VALUES ('%d', '%s', '%d', '0', '0', '1', '%s','%d','%d');",g_id,g_player[i],a,g_player[p],k,z)                                 query = SQL_PrepareQuery( g_DB, szQuery );                                 SQL_Execute( query )                             }                         }                     }                 }             }         }     }
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))

Last edited by ProIcons; 04-29-2011 at 22:25. Reason: Solved
ProIcons is offline
 


Thread Tools
Display Modes

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 04:31.


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