[Tutorial] New Code Optimizations
#23

Quote:
Originally Posted by Gammix
Посмотреть сообщение
Yes in most of the case, why care about negligible speed!


No, for all Pool sizes. Because the pool size have all the valid cells and if you don't use =, you'll miss the last cell.


Doesn't make sense if you use i++. It will turn out to be an infinite loop which will always exceed a value greater than Pool size every time (+1).
The loop you're using ( for example if MAX_PLAYERS is set to 40), it will start from 40 and every time do -1 which means that it's going the opposite direction. That doesn't mean that you optimized it in a better way, like you stated in your post.


Anyway I might be wrong, misread

Код:
Use the above if the order in which the code is executed does not matter. You can optimize that too further but I feel that it will reduce the readability of the code.
But still I was wondering since you say (+1), I wondered about the loop that uses i-- which in this case is
Код:
for(new i = GetPlayerPoolSize();--i != -1;) {}
Reply


Messages In This Thread
New Code Optimizations - by Yashas - 04.07.2015, 04:01
Re: New Code Optimizations - by Gammix - 04.07.2015, 09:59
Re: New Code Optimizations - by maximthepain - 04.07.2015, 10:33
Re: New Code Optimizations - by theYiin - 04.07.2015, 10:36
Re: New Code Optimizations - by Cypress - 04.07.2015, 10:42
Re: New Code Optimizations - by sammp - 04.07.2015, 10:51
Re: New Code Optimizations - by sammp - 04.07.2015, 10:59
Re: New Code Optimizations - by Gammix - 04.07.2015, 11:53
Re: New Code Optimizations - by Yashas - 04.07.2015, 15:49
Re: New Code Optimizations - by PT - 04.07.2015, 16:04
Re: New Code Optimizations - by Macluawn - 04.07.2015, 16:09
Re: New Code Optimizations - by Yashas - 04.07.2015, 16:17
Re: New Code Optimizations - by Gammix - 04.07.2015, 16:40
Re: New Code Optimizations - by Macluawn - 04.07.2015, 16:41
Re: New Code Optimizations - by Yashas - 04.07.2015, 16:53
Re: New Code Optimizations - by Macluawn - 04.07.2015, 16:56
Re: New Code Optimizations - by Yashas - 04.07.2015, 16:59
Re: New Code Optimizations - by Lynn - 04.07.2015, 17:17
Re: New Code Optimizations - by rymax99 - 04.07.2015, 17:52
Re: New Code Optimizations - by Gammix - 05.07.2015, 02:31
Re: New Code Optimizations - by Tamer - 05.07.2015, 19:50
Re: New Code Optimizations - by Stanford - 06.07.2015, 03:07
Re: New Code Optimizations - by Cypress - 06.07.2015, 20:31
Re: New Code Optimizations - by Yashas - 07.07.2015, 01:57
Re: New Code Optimizations - by Sime30 - 07.07.2015, 17:58
Re: New Code Optimizations - by kristo - 07.07.2015, 18:09
Re: New Code Optimizations - by Sime30 - 07.07.2015, 18:59
Re: New Code Optimizations - by JokeyL - 25.01.2016, 16:38
Re: New Code Optimizations - by iKarim - 25.01.2016, 16:45
Re: New Code Optimizations - by vannesenn - 16.06.2016, 23:38
Re: New Code Optimizations - by Crystallize - 16.06.2016, 23:43
Re: New Code Optimizations - by Gammix - 16.06.2016, 23:43
Re: New Code Optimizations - by Vince - 17.06.2016, 09:37
Re: New Code Optimizations - by Gammix - 17.06.2016, 10:02
Re: New Code Optimizations - by vannesenn - 17.06.2016, 14:38
Re: New Code Optimizations - by vannesenn - 17.06.2016, 21:23
Re: New Code Optimizations - by Yashas - 20.06.2016, 17:22
Re: New Code Optimizations - by Yashas - 21.07.2016, 13:23
Re: New Code Optimizations - by Kaperstone - 15.01.2018, 21:21
Re: New Code Optimizations - by Yashas - 31.01.2018, 17:42

Forum Jump:


Users browsing this thread: 9 Guest(s)