AMX size.
#1

hello mates,

I have very unusual problem (for the first time), I started write my second mode and so far I wrote about 1,5k lines, but the funny thing is that *.PWN file is about 54 KB, but the *.AMX file is over 3 MB so far, so I don't know what causes it, maybe someone had similar problem? or something?

I have hypotize that "returns" could cause it? I mean I don't use any returns in dialog case'as and stocks. (I'm not newbie at scripting, already written one mod which contains 25k lines and haven't had such a problem like this, but this happens for me first time).

Thank you guys for replies, cheers!
Reply
#2

Includes.
Reply
#3

I'm using only ZCMD, sscanf2 and MySQL, all of them are up to date, exept for MySQL which newest R7 somehow isn't working properly, anyways I guess it's happened after a half code wrote, I mean I noticed that compiler working longer as it has to work, however I looked at files size and I wasn't happy what I saw. Any other ideas?

Code basicly contains a lot of stocks, few dialogs (not few actually, about twenty~) everything is writed nicely, I don't know why it happened, especially when PWN is only 54 KB.

Cheers, thanks for reply.
Reply
#4

multi-dimensioned arrays, like
Код:
new HouseInfo[30000][50];
not to mention 3 dimensions with large numbers - a 3d matrix containing
Код:
new Node[6000][6000][2];
will already use 72000000 cells (72 MBytes at least), where a change from [2] to [4] already doubles the already huge amount needed:
Код:
new Node[6000][6000][4];
edit (addition):
oh btw, since my pathfinding script uses >300 MBytes ram (.amx is 92 MBytes large), it needed like 12 minutes to upload - needless to say that i always desync while iam ingame while uploading for more than like 30 seconds.
may i suggest you to compress your filterscript? i tried, and as i predicted, the tar compressor was able to reduce the size a "little", from 92 MBytes to 450 KBytes (yes, thats 99,5% redundant code). i uploaded it (.tar) in 4 seconds, and then decompressed it ingame by using the Exec plugin. it needs <1 second to write the .amx, another 30 seconds to load and jit-compile the script then.
i guess thats better than waiting 10 more minutes, desync, rage /q, reconnect etc.
Reply
#5

That makes sense, at the moment I'm creating a phone system, which contains a lot of that variables, well it's good to know from where that mb's are even that is very bad thing.

However, maybe do you know guys does the amx size effect a game? I mean does server lag more or something, just curious about it, because I can't even imagine how big amx file will be then I finish a mod...

In any case, thanks for a reply, appreciate.

EDIT: I was hoping to do it later, but now to check is it really by array's I did a undef/def MAX_PLAYERS from 500 to 100 and now file size is about 700 kB, thank you all for a replies, I got answer now, but now i'm curious does the amx size effects anything, does it do something in-game?
Reply
#6

Quote:
Originally Posted by Tomejus
Посмотреть сообщение
However, maybe do you know guys does the amx size effect a game? I mean does server lag more or something, just curious about it, because I can't even imagine how big amx file will be then I finish a mod...
No, it doesn't affect lag unless you are using some bad coded functions or a-lot of timers.
Reply
#7

Quote:
Originally Posted by Logitech90
Посмотреть сообщение
No, it doesn't affect lag unless you are using some bad coded functions or a-lot of timers.
Are you sure? Just asking. Anyway, thank you all for replies! Moderators can lock topic, but sure if someone has something useful to say, feel free to reply, cheers mates!

By the way, I'm pretty sure my code is good, and I do know how to optimize it, it just about arrays.
Reply
#8

once i had a simple idea to script a loop which counts up from 0 to 20,000,000 - it ran through in less than 1 second, so you could try to make a loop upto 10000000 "only", and add 1 command inside. as long it (the new loop) needs 1 second aswell, you can assume that the mentioned command/function called 10mio times, will work even if you add 10mio similar lines (not looped). the latter method will require more ram, but it will run faster, because the loop execution aint needed anymore. (in theory, true in most cases)
BUT: a really short loop fits into the CPU cache maybe, so it IS a good idea to use (short) loops.
Код:
new array[10000000];
for(new a=0;a<10000000;a++)
{
array[a]=1;
}
Код:
array[0]=1;
array[1]=1;
array[2]=1;
array[3]=1;
array[4]=1;
array[5]=1;
array[6]=1;
array[7]=1;
array[8]=1;
array[9]=1;
array[10]=1;
array[11]=1;
array[12]=1;
array[13]=1;
array[14]=1;
array[15]=1;
array[16]=1;
array[17]=1;
array[18]=1;
array[19]=1;
array[20]=1;
array[21]=1;
array[22]=1;
array[23]=1;
array[24]=1;
array[25]=1;
array[26]=1;
array[27]=1;
array[28]=1;
array[29]=1;
its up to you to decide (test) which way works better (faster/less ram/less cpu) for you ^^
sorry that i was too lazy to finish the second list upto array[9999999]...
Reply
#9

You can decrease the .amx size file by using rBits by RyDeR` or y_bits by ******.
It depends if you want only for 1 bit or more. For example, you're using too many variables that they are used for 0/1 and you're using a 32 bit variable. It takes a lot..
With that include, you can specify the variable and make it 1 bit (less).
Reply
#10

Yeah, because hdd space is soooo expensive! 0.08 euro per gigabyte, last time I checked. Calling a variable directly is bound to be faster than bit shifting and whatnot.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)