[DependencyInjection][FrameworkBundle][HttpKernel] Instantiate on demand the bundles that have nothing to do at boot time
The bundle list cached next to the container instantiated every bundle on every boot, which linked all their classes for nothing: a bundle that only declares getPath(), build(), configure() and loadExtension() does nothing once the container is built. The dumped file now stores class names and instantiates only the bundles that declare a constructor or a destructor, or that override boot(), shutdown() or setContainer(). The others are created when getBundle() or getBundles() asks for one. The console gets the same treatment: the bundles overriding the deprecated Bundle::registerCommands() method are listed at compile time in the console.command.bundles parameter, so Application instantiates only those instead of walking getBundles(). This matters more there than on the web, since opcache is usually disabled on the CLI and the process pays to parse each bundle's source rather than merely link it.
N
Nicolas Grekas committed
9891acd8ffb5306b912106ad061b5b7bc0da3b2f
Parent: f25726d