Tiny But Super Optimizations
#13

Quote:
Originally Posted by Vince
Посмотреть сообщение
Boohoo, 100 nanoseconds difference. Readability should always take precedence over such extremely negligible improvements.
Quote:
Originally Posted by Jay_
Посмотреть сообщение
Completely agree. This whole optimization thing is major overkill. I think it originated from Y_Less in that huge code optimazitions thread that was later proven redundant when it was benchmarked.
Coincidently, all the optimizations mentioned in this topic atm improve readability.

Which one is ugly?
Код:
new Float:pos[3];
GetPlayerPos(0, pos[0], pos[1], pos[2]);
OR

Код:
new Float:X, Float:Y, Float:Z;
GetPlayerPos(0, X, Y, Z);
This is the most annoying way to declare variables. Of course if one tells the compiler to stop compiling with debug information, the optimization would make no difference (assuming so since the sole purpose of break is to help the internal debugger)
Код:
    new tmp1;
    new tmp2;
    new tmp3;
    new tmp4;
    new tmp5;
Код:
new tmp1, tmp2, tmp3, tmp4, tmp5;
Which is better?
Код:
    tmp1 = 17;
    tmp2 = 17;
    tmp3 = 17;
    tmp4 = 17;
    tmp5 = 17;

    tmp1 = tmp2 = tmp3 = tmp4 = tmp5 = 17;
and what is wrong with this one?
Код:
    if(tmp1 == 1)
        if(tmp2 == 1)
            if(tmp3 == 1)
                if(tmp4 == 1)
                    if(tmp5 == 1) 
                        {}

    if(tmp1 == 1 && tmp2 == 1 && tmp3 == 1 && tmp4 == 1 && tmp5 == 1) {}
These optimizations though tiny actually make the code more readable. There is no reason why someone shouldn't do these optimizations.

Maybe someday in future, I will make a neat topic which will list optimizations that really make a "big" improvement which are actually based on "smart ideas" rather than coding techniques.
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: 3 Guest(s)