Page 2 of 2

Re: Help With Arrays

Posted: Mon Aug 17, 2009 8:35 pm
by redmonkey
Of course it's highly unlikely that a bottle neck could be traced back to a single call to a native function however, when used within a complex looping algorithm these things can make a difference. As the old saying goes.. "The devil is in the detail".

Re: Help With Arrays

Posted: Mon Aug 17, 2009 8:41 pm
by Eran
the old saying is "97% of the time, premature optimization is evil"
No matter how complex your loop is, this will not be the deal breaker or even difference maker. controlling the complexity should be your main priority. bottlenecks mean real chances for optimization, and this is not one of them. Also consider the platform, this might be appropriate on embedded systems in assembler, not PHP for web development

Re: Help With Arrays

Posted: Mon Aug 17, 2009 8:54 pm
by redmonkey
Indeed I agree, getting caught up in these types of optimizations early on in a project or spending a full day to shave 3ns off execution time will most likely be detrimental to project development. However, at the same, I also don't think it's wise to completely disregard this type of thing. Bottom line is that any time saving regardless of how small is a time saving which is a benefit to performance.

Re: Help With Arrays

Posted: Mon Aug 17, 2009 9:38 pm
by jackpf
As long as the time difference isn't ridiculous, I'd always go for the option that works best for me.

And since, as I said, NULL can be used in complex statements whereas empty() cannot, NULL works best for me...