How to fix my compiler
#8

Lets say you want to save player name for each player to a variable. So you create variable:
pawn Код:
new PlayerName[MAX_PLAYERS][128];
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.
Reply


Messages In This Thread
How to fix my compiler - by Saliim - 30.04.2016, 17:16
Re: How to fix my compiler - by OmegaKiller72 - 30.04.2016, 17:27
Re: How to fix my compiler - by Saliim - 30.04.2016, 17:34
Re: How to fix my compiler - by MBilal - 30.04.2016, 17:40
Re: How to fix my compiler - by DRIFT_HUNTER - 30.04.2016, 17:40
Re: How to fix my compiler - by Saliim - 30.04.2016, 17:46
Re: How to fix my compiler - by OmegaKiller72 - 30.04.2016, 17:58
Re: How to fix my compiler - by DRIFT_HUNTER - 30.04.2016, 18:02
Re: How to fix my compiler - by Saliim - 30.04.2016, 18:40

Forum Jump:


Users browsing this thread: 1 Guest(s)