Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DependencyInjection] Perf php dumper #12855

Merged
merged 3 commits into from
Dec 11, 2014

Conversation

nicolas-grekas
Copy link
Member

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

This PR came up after this comment to reduce the number of calls to dirname():
#12784 (comment)

Conflicts:
	src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
	src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services11.php
	src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php
	src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
	src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php
*
* @return array An array of the default parameters
*/
protected function getDefaultParameters()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a bc break which cannot be done in 2.3

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the method could be kept for BC. It is not incompatible with the usage of target dirs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then why did we remove it in 2.6?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, and keep in mind that this function is dumped optionally, IF there is a parameter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, IIRC, we thought that removing it in the minor version was an acceptable BC break, because it breaks BC only for a really weird edge case: people writing a class extending the dumped one and changing/using the method to get default parameters

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok great, then I'll revert this bc also

@nicolas-grekas
Copy link
Member Author

This is ready: I reverted the drop of getDefaultParameters() - there is no gain to expect from here, even in 2.6.
The 3 steps git history should help merging back into 2.5 then 2.6.
One file will need an update on 2.6 after the merge:

--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php
@@ -17,6 +17,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
 class ProjectServiceContainer extends Container
 {
     private $parameters;
+    private $targetDirs = array();

     /**
      * Constructor.

@nicolas-grekas nicolas-grekas changed the title Perf php dumper [DependencyInjection] Perf php dumper Dec 5, 2014
// but every other sub-dir is optional up to the full path in $dir
// Mandate at least 2 root dirs and not more that 5 optional dirs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why at least 2 root dirs ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we need a distinctive enough string: zero would mean matching a single DIRECTORY_SEPARATOR, which is not enough - and one looked too low also to me. Two should work for everyone - and be distinctive enough

This reverts commit c11535b.

Conflicts:
	src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
	src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php
	src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php
	src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php
	src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php
	src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php
	src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
	src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php
@fabpot
Copy link
Member

fabpot commented Dec 11, 2014

Thank you @nicolas-grekas.

@fabpot fabpot merged commit 375f83e into symfony:2.3 Dec 11, 2014
fabpot added a commit that referenced this pull request Dec 11, 2014
This PR was merged into the 2.3 branch.

Discussion
----------

[DependencyInjection] Perf php dumper

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

This PR came up after this comment to reduce the number of calls to dirname():
#12784 (comment)

Commits
-------

375f83e Revert "[DependencyInjection] backport perf optim"
fcd8ff9 [DependencyInjection] perf optim: call dirname() at most 5x
c11535b [DependencyInjection] backport perf optim
@nicolas-grekas nicolas-grekas deleted the perf-php-dumper branch December 11, 2014 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants