Can excessive use of constants affect system performance?

1

I use a lot of constantes in php to save information to configure the system

  

Example:

define('_CONFIG_SERVER','PC\SQLEXPRESS');
define('_CONFIG_DATA','Database');
define('_CONFIG_NAME','localhost');
define('_CONFIG_LANGUAGE_DEFAULT','pt-BR');

I really use it ... This can slow down the system performance?

I found a topic similar, but does not answer my question that in this case is the performance issue!

    
asked by anonymous 09.02.2016 / 18:33

1 answer

3

Yes it can, but "overuse" would set thousands of constants in each page load. Are you setting 20, 50, maybe even 100? So it's probably irrelevant and trying to change that would be micro-optimization, there are lots of other things infinitely more important to your code's performance than something like that.

If you're really doing something crazy with tons of constants you can try to take a look in this extension whose purpose is to optimize mass definition of constants.

    
09.02.2016 / 19:06