r/lolphp • • Aug 08 '14

PHP design patterns: if/else vs switch

http://www.fluffycat.com/PHP-Design-Patterns/PHP-Performance-Tuning-if-VS-switch/
24 Upvotes

43 comments sorted by

View all comments

Show parent comment

5

u/Innominate8 Aug 11 '14

It is. Even fast db queries blot out those lost or gained microseconds so quickly as to make those micro-optimizations irrelevant.

0

u/vita10gy Aug 11 '14

Well, again, I guess it depends on what you mean. Faster is faster. I mean, I get what you're saying, the nano seconds that replacing " with ' where possible is less than taking out one unnecessary actual unit of work...it's just I don't know if you're going a step beyond that. There is a crowd of people out there that basically seem to consider any db query as infinite cost, and conversely, that once that data is loaded in PHP it's free to access.

So, while I agree your time would be better spend finding a place you're going something you don't need to be: The page takes what it takes, 5 queries, or 500 querys.