0

I wonder if a large number of composer packets included to my Symfony 2 application slows it down.

For example, I installed nestbot/Carbon, and used it only twice.

Should I be careful of the amount of packages Im including? Does this have any impact on application performance, or they are loaded only when they need to?

  • They're **autoloaded** - meaning the actual including / lexing occurs when your app needs it. After that, it's cached via `opcache` so the same process doesn't occur again. Basically, your app is "slow" once. – Mjh Oct 05 '15 at 10:20

2 Answers2

0

Not really. Composer installs extra PHP code under the Vendor directory and your appKernel.php Includes it (using the autoloader). Its just the same when you write an extra class and use the include statement to load it in your application. Of course it takes some microseconds but that is nothing to worie about.

Frank B
  • 3,667
  • 1
  • 16
  • 22
0

Avoid "optimizing" the autoloader. Using huge amount of classes in very few cases will directly affect the threshold ratio of performance gain of an optimized classmap vs. the performance penalty of loading a big classmap. See my other answer here: Why use a PSR-0 or PSR-4 autoload in composer if classmap is actually faster?

Community
  • 1
  • 1
Sven
  • 69,403
  • 10
  • 107
  • 109