I've been coding for over 20 years now! (WOAH, do I feel old)
I've touched just about every resource imaginable under the Sun (too bad they were bought out by Oracle)
About that last point, it truly is a "micro-optimization", in that, odds are there are other areas that are in the orders of hundreds to thousands of times more CPU intensive within the code that could be optimized using better overall application logic. Micro-optimizations are things we put in that we think will make a difference that really don't in the grand scheme of things.
Measuring the impact of having the leading slash or not results in ~1-8ms better performance across one-million executions. With such a minor difference in performance, a developer's time would honestly be better spent on more significant portions of the application.
I've been coding for over 20 years now! (WOAH, do I feel old)
I've touched just about every resource imaginable under the Sun (too bad they were bought out by Oracle)
Doing further investigating, it is actually MORE impactful to not use namespaces at all. If you are not actively within a namespace, and you don't use the leading \, then you get even more "micro-optimization" out of your code! ;)
About that last point, it truly is a "micro-optimization", in that, odds are there are other areas that are in the orders of hundreds to thousands of times more CPU intensive within the code that could be optimized using better overall application logic. Micro-optimizations are things we put in that we think will make a difference that really don't in the grand scheme of things.
Measuring the impact of having the leading slash or not results in ~1-8ms better performance across one-million executions. With such a minor difference in performance, a developer's time would honestly be better spent on more significant portions of the application.
3v4l.org/QaY2t
Doing further investigating, it is actually MORE impactful to not use namespaces at all. If you are not actively within a namespace, and you don't use the leading \, then you get even more "micro-optimization" out of your code! ;)
3v4l.org/tmJMq