Reducing mod size
#1

I've been writing a mod which is so far only 13.000 lines, but it takes very long to convert it, like 3 or 4 minutes. And the AMX file is 36mb.

Are there any solutions to this? How can I decrease the size of the mode?

Converting summary:
Код:
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Header size:          13088 bytes
Code size:           883272 bytes
Data size:         148238164 bytes
Stack/heap size:      16384 bytes; estimated max. usage=4488 cells (17952 bytes)
Total requirements:149150908 bytes
Includes that I use in the mod:
Код:
#include <a_samp>
#include <a_mysql>
#include <zcmd>
#include <sscanf2>
#include <fixchars>
#include <foreach>
#include <streamer>
#include <eSelection>
#include <cuff>
Now I started using global strings. This is one of the solutions I thought of.
Reply
#2

Quote:
Originally Posted by Ripster
Посмотреть сообщение
Now I started using global strings. This is one of the solutions I thought of.
This is not a solution and will only lead to more spaghetti code and potentially more problems due the variable unexpectedly being overwritten elsewhere. Avoid globals where possible.

What you want to avoid are large local arrays. Use only as much cells as can be expected to be reasonably necessary to hold the final output string.
Reply
#3

Does this count as a long array?

Код:
mysql_format(mysql, query, sizeof(query), "INSERT INTO `accounts` (`Name`, `Password`, `IP`, `Admin`, `Level`, `Money`, `PosX`, `PosY`, `PosZ`, `PosA`, `Eletkor`, `Nem`, `Skin`, `Szarmazas`, `Health`, `Armor`, `BankEgyenleg`, `BankSzamla`, `BankJelszo`, `TelAllapot`, `TelSzam`, `TelEgyenleg`, `Interior`, `VirtualWorld`, `Munka`, `MunkaRang`, `Leader`) VALUES ('%e', '%e', '%e', 0, 0, 0, %f, %f, %f, %f, %d, %d, %d, %d, 100.0, 0.0, 0, '%e', '%e', 1, '%e', 0, 0, 0, 0, 0, 0)",
			playername, Player[playerid][Password], playerip, SPAWN_X, SPAWN_Y, SPAWN_Z, SPAWN_A, Player[playerid][Adat][0], Player[playerid][Adat][1], Player[playerid][Adat][2], Player[playerid][Adat][3], Player[playerid][BankSzamla], Player[playerid][BankJelszo], Player[playerid][TelSzam]);
            mysql_tquery(mysql, query, "OnAccountRegister", "i", playerid);
Reply
#4

Quote:
Originally Posted by Ripster
Посмотреть сообщение
Does this count as a long array?

Код:
mysql_format(mysql, query, sizeof(query), "INSERT INTO `accounts` (`Name`, `Password`, `IP`, `Admin`, `Level`, `Money`, `PosX`, `PosY`, `PosZ`, `PosA`, `Eletkor`, `Nem`, `Skin`, `Szarmazas`, `Health`, `Armor`, `BankEgyenleg`, `BankSzamla`, `BankJelszo`, `TelAllapot`, `TelSzam`, `TelEgyenleg`, `Interior`, `VirtualWorld`, `Munka`, `MunkaRang`, `Leader`) VALUES ('%e', '%e', '%e', 0, 0, 0, %f, %f, %f, %f, %d, %d, %d, %d, 100.0, 0.0, 0, '%e', '%e', 1, '%e', 0, 0, 0, 0, 0, 0)",
			playername, Player[playerid][Password], playerip, SPAWN_X, SPAWN_Y, SPAWN_Z, SPAWN_A, Player[playerid][Adat][0], Player[playerid][Adat][1], Player[playerid][Adat][2], Player[playerid][Adat][3], Player[playerid][BankSzamla], Player[playerid][BankJelszo], Player[playerid][TelSzam]);
            mysql_tquery(mysql, query, "OnAccountRegister", "i", playerid);
https://sampforum.blast.hk/showthread.php?tid=318212
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)