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

[Dependency Injection] Improve PhpDumper Performance for huge Containers #13991

Closed
wants to merge 1 commit into from
Closed

[Dependency Injection] Improve PhpDumper Performance for huge Containers #13991

wants to merge 1 commit into from

Conversation

BattleRattle
Copy link
Contributor

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

After making public services private, the dumping of the DIC takes much longer. This is due to the reference lookup method. Using the visited lookup as reference speeds up the whole dump (in our case by a factor of ~40).

Some stats from our DIC:
before: 32 sec. for dumping
after: 0.9 sec.

@stof
Copy link
Member

stof commented Mar 22, 2015

Looks good to me. 👍

@GromNaN
Copy link
Member

GromNaN commented Mar 22, 2015

Instead passing the array by reference, this array could be replaced by a SplObjectStorage or an ArrayObject.

@fabpot
Copy link
Member

fabpot commented Mar 23, 2015

Thank you @BattleRattle.

fabpot added a commit that referenced this pull request Mar 23, 2015
…uge Containers (BattleRattle)

This PR was submitted for the 2.7 branch but it was merged into the 2.3 branch instead (closes #13991).

Discussion
----------

[Dependency Injection] Improve PhpDumper Performance for huge Containers

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

After making public services private, the dumping of the DIC takes much longer. This is due to the reference lookup method. Using the visited lookup as reference speeds up the whole dump (in our case by a factor of ~40).

Some stats from our DIC:
before: 32 sec. for dumping
after: 0.9 sec.

Commits
-------

2cc5011 use visited lookup with reference to gain performance
@fabpot fabpot closed this Mar 23, 2015
@BattleRattle BattleRattle deleted the phpdumper-performance branch March 23, 2015 09:29
@stof
Copy link
Member

stof commented Mar 23, 2015

@GromNaN no it cannot be an SplObjectStorage. references pointing to the same id will still be separate instances

@GromNaN
Copy link
Member

GromNaN commented Mar 23, 2015

Well spotted @stof. Then an ArrayObject would work exactly like the array while being passed by reference natively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants