Is there a performance penalty to accessing a constant within a namespace that was defined outside the namespace WITHOUT using the \ namespace trigger?
ie. Is echo MYCONSTANT slower than echo \MYCONSTANT ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Silly microptimizations are silly. If you want to optimize anything, then use the frigging profiler and look at a shiny graph that gives relevant results for the whole application. Optimizing the tiniest pieces makes no sense, when it’s SQL queries and loops that are slowing down the application.
I’m just giving you a list because it puts namespaced code in a bad light. Also, very unscientific. Can’t be bothered to run 100 tests.
Only run with PHP 5.3. And the minuscle differences are probably from the parser/tokenizer. Not factual runtime performance discrepancies.