This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/DependencyInjection/Tests
Nicolas Grekas 6d3f63d6f3 feature #27783 [DI] Add ServiceLocatorArgument to generate array-based locators optimized for OPcache shared memory (nicolas-grekas)
This PR was merged into the 4.2-dev branch.

Discussion
----------

[DI] Add ServiceLocatorArgument to generate array-based locators optimized for OPcache shared memory

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | -
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Right now, to generate service locators, we use collections of closures described using `ServiceClosureArgument`. This works well, but it doesn't scale well when the number of services grows, because we have to load as many closures as there are services, even if we never call them.

This PR introduces `ServiceLocatorArgument`, which describes the same thing, but allows dumping optimized locators: instead of a collection of closures, this generates a static array that OPcache can put in shared memory (see fixtures for example.)

Once this PR is merged, we'll be able to update `ServiceLocatorPass::register()` to leverage it and generate these optimized locators everywhere. One particular I have in mind in the locator used by `ServiceArgumentResolver`, which can grow fast (it has as many entries as there are actions.)

Commits
-------

6c8e9576a3 [DI] Add ServiceLocatorArgument to generate array-based locators optimized for OPcache shared memory
2018-07-07 17:01:23 +02:00
..
Argument [DI] Introduce "container.service_locator" tag, replaces ServiceLocatorArgument 2017-03-17 17:49:32 +01:00
Compiler Merge branch '4.1' 2018-07-05 13:54:37 +02:00
Config [DI] Remove remaining deprecated features 2017-07-12 12:42:06 +02:00
Dumper [DI] Add ServiceLocatorArgument to generate array-based locators optimized for OPcache shared memory 2018-07-04 16:01:49 +02:00
Extension do not mock the container builder in tests 2018-02-08 09:15:30 +01:00
Fixtures [DI] Add ServiceLocatorArgument to generate array-based locators optimized for OPcache shared memory 2018-07-04 16:01:49 +02:00
LazyProxy [DI][ProxyManager] Pass the factory code to execute to DumperInterface::getProxyFactoryCode() 2017-07-27 19:12:50 +02:00
Loader [DI][DX] Allow exclude to be an array of patterns (taking #24428 over) 2018-05-09 18:00:53 +02:00
ParameterBag fixed some deprecation messages 2017-12-31 07:59:27 +01:00
ChildDefinitionTest.php [DI] Remove remaining deprecated features 2017-07-12 12:42:06 +02:00
ContainerBuilderTest.php [DI] Add ServiceLocatorArgument to generate array-based locators optimized for OPcache shared memory 2018-07-04 16:01:49 +02:00
ContainerTest.php fixed some deprecation messages 2017-12-31 07:59:27 +01:00
CrossCheckTest.php [DI] Remove deprecated case insensitive service ids 2017-07-11 16:00:59 +02:00
DefinitionTest.php Merge branch '3.4' 2017-09-26 08:12:47 +02:00
EnvVarProcessorTest.php [DI] Select specific key from an array resolved env var 2018-05-21 20:16:14 +02:00
ParameterTest.php Update to PHPUnit namespaces 2017-02-18 08:02:39 -08:00
ReferenceTest.php Merge branch '3.2' 2017-02-18 18:35:19 +01:00
ServiceLocatorTest.php [DI] Add context to service-not-found exceptions thrown by service locators 2017-12-09 20:32:41 +01:00
ServiceSubscriberTraitTest.php [DependencyInjection] add ServiceSubscriberTrait 2018-06-04 21:55:50 +02:00