Hacker News new | ask | show | jobs
by Nicolas___ 5212 days ago
These tips are good practices, but they are micro-optimisations. The function strtr might be 4 times faster than str_replace, but the time saved by using strtr will represent a tiny tiny tiny portion of your script execution time.

Micro-optimisations are worth it when everything else is optimized in your application. You might get way better results by focusing on your database structure or the way you store, retrieve and cache your data.

What's listed here doesn't lead to "highly efficient code". More like "A tiny little bit more efficient code". Doesn't hurt doing it though.

1 comments

Actually, these tips for PHP coding cannnot guarantee improving efficiency in every project. For different apps,some of these tips may be very useful.For example, I was involved in one of the H.264 decoder development, some of the tiny operations would be run thousands times when decoding a video clip, even a small optimization improved the peformance largely.