Huge amx
#1

Hi, I'm creating a TDM gamemode which has 2149 lines right now, but the amx is 6,19 mb. I have a gamemode with 45k lines and it's amx is like 3mb, I added there like 6k lines of code though. What could be causing this? Also I use a few includes (y_ini, sscanf, zcmd, foreach, progress2), everytime I add like hundred lines of code I get like 1mb. I'm scripting the same way I do on the 45k lines gamemode, but for some reason the TDM's amx is getting very high. The gamemode is OK thoughl, it's not even poorly optimized. What could be causing this problem?
Reply
#2

6.19 is "Huge"? Are you using a floppy?

Anyways, you probably have large arrays. Either that or an include does. It's not that big of a deal in this case unless you are using them poorly.
Reply
#3

Quote:
Originally Posted by Crayder
Посмотреть сообщение
6.19 is "Huge"? Are you using a floppy?

Anyways, you probably have large arrays. Either that or an include does. It's not that big of a deal in this case unless you are using them poorly.
Is it bad though if the amx is big or it doesn't change anything at all? Yes, 6.19 is huge for me because I got a gamemode with 45k lines that got like 3. :P
Reply
#4

8628 lines on one of my gamemode and the .amx file is 4.56 Mo. I think you need to optimize your code.
There is a lot of thread: http://forum.sa-mp.com/search.php?se...0&pp=25&page=2 about optimization.
Reply
#5

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
8628 lines on one of my gamemode and the .amx file is 4.56 Mo. I think you need to optimize your code.
There is a lot of thread: http://forum.sa-mp.com/search.php?se...0&pp=25&page=2 about optimization.
My code is OK, I've tried to make it as perfect as possible. Like I'm doing it the same way I do it on my roleplay gamemode, but this one has a big amx for some reason.
Reply
#6

If you want, I can personally look at your code in like half an hour. Just PM me. That'll be a lot easier than asking you questions about specific stuff. Then you can come here and tell everybody what the problem was if we find it.
Reply
#7

My 15k lines gamemode's .amx is of 1.15 MB :O
Reply
#8

Just to point things out... I can easily make a 2 line script that would be well over 6.19mb...

For example, the following would be around 10000kb (~10mb, and easily expandable to a lot more) because of the "arr[10000][1024]":
pawn Код:
new arr[10000][1024];
main() arr[0][0] = EOS;


And another example, I can easily make a 200k line script that is less than 1mb:
pawn Код:
new p;
addUpp() p++;
main() {
    addUpp();
    addUpp();
    addUpp();
    addUpp();
    //... And more of "addUpp();" to make up 200k lines...
    //...
    addUpp();
    addUpp();
}
And half that without the function call:
pawn Код:
new p;
main() {
    p++;
    p++;
    p++;
    p++;
    // more "p++;"
    // ...
    p++;
    p++;
    p++;
    p++;
}
Reply
#9

6MB is nothing, I've seen GMs with minutes of compile time and +40 MB size, That all comes back to the coding style of the one writing it.
You can try and conserve as much space as you can or you just can trade ram and space for cpu.
Reply
#10

Surprisingly I have a 30,000+ lines on my script yet I only have like 8.15MB as a file size on my AMX, and I am using tons of includes and it's even badly optimized (not that bad but some parts goes messy, I have started working on it again and whenever I see these parts I get lost on coding lol)

Have you tried undefining MAX_PLAYERS and re-defining it again?

PHP код:
#undef MAX_PLAYERS
#define MAX_PLAYERS (currently servers slot you have) 
I might be wrong but MAX_PLAYERS are set to 500 (SA-MP regular server package), 1000 (SA-MP 1K server package). Which means if you create something like new test[MAX_PLAYERS], You'd be like doing this, new test[500] (test[1000])

Try it out and tell us the results.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)