Better, faster function?
#2

Well, its about what you want. Every function call takes some cpu time, so the first variant will be slower than the second one. Therefore it does not use a variable, so it uses less ram. So you have to decide if you want low cpu load or low ram useage, these are the common two options when optimizing code.
"else" is always a good thing to use when you are sure that only one condition will be true, as you dont have to check all the others then, but especially in situations like this i would recommend "switch", this should be more efficient than both "if" variants.
Reply


Messages In This Thread
Better, faster function? - by ||123|| - 17.07.2011, 18:09
Re: Better, faster function? - by Mauzen - 17.07.2011, 18:21
Re: Better, faster function? - by ||123|| - 17.07.2011, 18:32
Re: Better, faster function? - by Mauzen - 17.07.2011, 19:01
Re: Better, faster function? - by MoroDan - 17.07.2011, 19:15
Re: Better, faster function? - by MrDeath537 - 17.07.2011, 19:36
Re: Better, faster function? - by ||123|| - 17.07.2011, 21:12

Forum Jump:


Users browsing this thread: 1 Guest(s)