Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6830121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:34:50+00:00 2026-05-26T22:34:50+00:00

Is there a performance penalty to accessing a constant within a namespace that was

  • 0

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 ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:34:51+00:00Added an answer on May 26, 2026 at 10:34 pm

    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.

                              PHP 5.3            PHP 5.4
    
     CONSTI in global scope    1.69s              2.02s
     \CONSTI in global scope   1.87s              2.20s
     CONSTI in namespace       2.01s              2.25s
     \CONSTI in namespace      1.87s (varying)    2.13s   (for 1M runs)
    

    Only run with PHP 5.3. And the minuscle differences are probably from the parser/tokenizer. Not factual runtime performance discrepancies.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any performance penalty in using the var declaration in c# 3.0+? Resharper
Or to reformulate the question: is there a performance penalty in using unsigned values?
Is there a runtime performance penalty when using interfaces (abstract base classes) in C++?
I realize that, generally speaking, there are performance implications of using reflection. (I myself
I'm wondering if there's a performance penalty when doing the following vs using plain
Is there a performance penalty when using a SecurityManager? I need the following: public
Is there any performance penalty to define all methods as transactional using Spring AOP
Is there any performance penalty for the following code snippet? for (int i=0; i<someValue;
I have some high-performance C++ that I need to interface with Objective-C, is there
Is there a performance penalty for working with a vector from the standard library

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.