Help With Arrays

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Re: Help With Arrays

Post 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".
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Help With Arrays

Post 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
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Re: Help With Arrays

Post 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.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Help With Arrays

Post 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...
Post Reply