30.04.2016, 18:02
Lets say you want to save player name for each player to a variable. So you create variable:
Now player name can only be 24 characters long and you used 128. So anything beyond 24 is a waste as it will never be used.
In a memory usage perspective, lets count difference between 24 and 128.
Pawn uses cells for every variable (Float,Int,Char, anything). And if im not mistaking cell in pawn is 32bit or 4 Bytes.
So MAX_PLAYERS (1000) * 128 Cells = 128 000 Cells * 4 Bytes = 512000Bytes or ~500KB
But if you use 24 cells for username. Than 1000*24 = 24000*4=96000B = ~90KB
Now 500KB and 90KB...So 128 and 24 cells for each player, that is a big difference, much bigger than it seems on first sight.
pawn Код:
new PlayerName[MAX_PLAYERS][128];
In a memory usage perspective, lets count difference between 24 and 128.
Pawn uses cells for every variable (Float,Int,Char, anything). And if im not mistaking cell in pawn is 32bit or 4 Bytes.
So MAX_PLAYERS (1000) * 128 Cells = 128 000 Cells * 4 Bytes = 512000Bytes or ~500KB
But if you use 24 cells for username. Than 1000*24 = 24000*4=96000B = ~90KB
Now 500KB and 90KB...So 128 and 24 cells for each player, that is a big difference, much bigger than it seems on first sight.