Tiny But Super Optimizations
#27

Quote:
Originally Posted by Wolfe
View Post
This is a proper way of doing it
pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
    for(new i = 0; i < sizeof(Players[]); i++) {
        Players[playerid][pInfo:i] = 0; // or whatever ur player array is
    }
    return 1;
}
Of course if you use that make sure that you have your saving above it so you don't clear the players data entirely.

But for this thread this is completely unnecessary just for the minimal performance difference, it's not worth changing or doing in your current or future game modes. Eh I could see someone using it if they just found out about this way, and want to use it for the nano second differences, but not changes to already made GM's unless their that hungry for the performance.
Thats the wrong way to do it, amiga's way is faster, easier and well .. 'proper'.
What people not seem to understand is this topic first assumes(or should) you have a heavily repetitive code, I.E a loop in OPU (Which honestly you shouldn't, but for the sake of example ...) then, having just 100 nanosec saved is alot for a code that loops MAX_SOMETHING 40 times a second.
And also even tho speed might not matter, some of these tiny optimizations are better coding habits, for example I won't sacrifice readability for nano speeds speeds like this:
PHP Code:
for(new i=MAX_SOMETHING;--i!=-1;) //this was bit faster than normal one as I remember 
but I would still have this code instead of the 5 declaration one.
PHP Code:
    new    HouseI[MAX_HOUSES][HouseInfo],
        
IteratorHouses<MAX_HOUSES>,
        
Housebla[MAX_HOUSES],
        
Houseblabla[MAX_HOUSES],
        
Houseblablabla[MAX_HOUSES]; 
Same in the case of readability because of indentation and faster in case of optimization.
Reply


Messages In This Thread
Tiny But Super Optimizations - by Crayder - 28.04.2016, 18:13
Re: Tiny But Super Optimizations - by iGetty - 01.05.2016, 22:18
Re: Tiny But Super Optimizations - by lolumadd_ - 01.05.2016, 22:28
Re: Tiny But Super Optimizations - by Mauzen - 01.05.2016, 22:54
Re: Tiny But Super Optimizations - by AmigaBlizzard - 01.05.2016, 23:20
Re: Tiny But Super Optimizations - by Crayder - 02.05.2016, 02:44
Re: Tiny But Super Optimizations - by PrO.GameR - 02.05.2016, 11:54
Re: Tiny But Super Optimizations - by Vince - 02.05.2016, 12:39
Respuesta: Tiny But Super Optimizations - by aoEXE - 02.05.2016, 13:11
Re: Tiny But Super Optimizations - by Darkwood17 - 02.05.2016, 14:14
Re: Tiny But Super Optimizations - by Crayder - 02.05.2016, 14:26
Re: Tiny But Super Optimizations - by Konstantinos - 02.05.2016, 14:28
Re: Tiny But Super Optimizations - by Yashas - 02.05.2016, 15:27
Re: Tiny But Super Optimizations - by Mauzen - 02.05.2016, 17:52
Re: Tiny But Super Optimizations - by Slice - 02.05.2016, 22:51
Re: Tiny But Super Optimizations - by Macluawn - 03.05.2016, 21:54
Re: Tiny But Super Optimizations - by Crayder - 03.05.2016, 23:04
Re: Tiny But Super Optimizations - by SyS - 04.05.2016, 03:42
Re: Tiny But Super Optimizations - by Crayder - 04.05.2016, 04:24
Re: Tiny But Super Optimizations - by SyS - 04.05.2016, 08:14
Re: Tiny But Super Optimizations - by Marshall32 - 04.05.2016, 08:22
Re: Tiny But Super Optimizations - by Slice - 04.05.2016, 08:29
Re: Tiny But Super Optimizations - by GhostHacker - 04.05.2016, 08:33
Re: Tiny But Super Optimizations - by SyS - 04.05.2016, 08:34
Re: Tiny But Super Optimizations - by Ritzy2K - 04.05.2016, 09:10
Re: Tiny But Super Optimizations - by Wolfe - 04.05.2016, 09:22
Re: Tiny But Super Optimizations - by PrO.GameR - 04.05.2016, 10:23
Re: Tiny But Super Optimizations - by Donboo - 26.08.2016, 09:30
Re: Respuesta: Tiny But Super Optimizations - by PrO.GameR - 27.10.2016, 00:25
Respuesta: Re: Respuesta: Tiny But Super Optimizations - by Swedky - 29.10.2016, 06:05
Re: Respuesta: Re: Respuesta: Tiny But Super Optimizations - by Crayder - 29.10.2016, 17:57
Re: Tiny But Super Optimizations - by NeXoR - 31.10.2016, 03:02
Re: Tiny But Super Optimizations - by Freaksken - 15.11.2016, 13:04
Re: Tiny But Super Optimizations - by Awide - 24.11.2016, 20:16
Re: Tiny But Super Optimizations - by Crayder - 25.11.2016, 03:07
Re: Tiny But Super Optimizations - by Yashas - 25.11.2016, 04:24

Forum Jump:


Users browsing this thread: 1 Guest(s)