Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Form/Profiler] Massively reducing memory footprint of form profiling pages... #27923

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

Merged
merged 1 commit into from
Jul 12, 2018

Conversation

VincentChalnot
Copy link

… by removing redundant 'form' variable from view variables.

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

Problem

When trying to profile large forms in web profiler, the page can get so big that the memory footprint of the web browser excedes 1Gb making everything unusable and sometimes crashing the browser.

This is especially true for "deep" forms as every node of the form also contains its children in the debugging infos.

Solution

When removing the "form" view variable that actually contains duplicated contents of everything already displayed in the page, the memory footprint massively decrease making the page usable again even form very complex and deep forms.

By using CutStub, we keep a necessary level of information by providing the information that the variable is indeed here but not directly accessible in the dump.

… pages by removing redundant 'form' variable from view variables.
Copy link
Member

@yceruto yceruto left a comment

Choose a reason for hiding this comment

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

Tested in my project where I couldn't access the form profile due to the memory limit reached, thank you @VincentChalnot!

@xabbuh
Copy link
Member

xabbuh commented Jul 11, 2018

For 2.8?

@VincentChalnot
Copy link
Author

@xabbuh I never had this problem in Symfony 2.8 so I created this PR on the 3.4 branch but I can rebase on the 2.8 version if it can be backported to 3.4 after that.
I don't have any project in 4+ to test it.

@ogizanagi
Copy link
Contributor

Great first contribution!
I think this cannot go as is in 2.8 anyway, as we don't use the VarDumper component in profiler yet (only since 3.x). So this PR targeting 3.4 is fine.

@xabbuh xabbuh added this to the 3.4 milestone Jul 11, 2018
Copy link
Member

@fabpot fabpot left a comment

Choose a reason for hiding this comment

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

What a great first contribution!

@fabpot
Copy link
Member

fabpot commented Jul 12, 2018

Thank you @VincentChalnot.

@fabpot fabpot merged commit 5f5077f into symfony:3.4 Jul 12, 2018
fabpot added a commit that referenced this pull request Jul 12, 2018
…m profiling pages... (VincentChalnot)

This PR was merged into the 3.4 branch.

Discussion
----------

[Form/Profiler] Massively reducing memory footprint of form profiling pages...

… by removing redundant 'form' variable from view variables.

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

## Problem
When trying to profile large forms in web profiler, the page can get so big that the memory footprint of the web browser excedes 1Gb making everything unusable and sometimes crashing the browser.

This is especially true for "deep" forms as every node of the form also contains its children in the debugging infos.

## Solution
When removing the "form" view variable that actually contains duplicated contents of everything already displayed in the page, the memory footprint massively decrease making the page usable again even form very complex and deep forms.

By using CutStub, we keep a necessary level of information by providing the information that the variable is indeed here but not directly accessible in the dump.

Commits
-------

5f5077f [Form/Profiler] Massively reducing memory footprint of form profiling pages by removing redundant 'form' variable from view variables.
@VincentChalnot VincentChalnot deleted the form_profiling_optim branch July 12, 2018 08:03
@VincentChalnot
Copy link
Author

@yceruto, @ogizanagi, @fabpot thank you for your kind words.

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Jul 23, 2018

Oups, there is an issue here: this turns VarDumper into a mandatory dependency. I'm having a look right now.

@VincentChalnot
Copy link
Author

I assumed it was already a mandatory dependency but I see that there is a hack in the FormDataCollector class to handle whether the VarDumper component exists or not... Do you need me to fix my PR?

@nicolas-grekas
Copy link
Member

@yceruto @VincentChalnot can you please confirm #28037 also fixes the issue?

nicolas-grekas added a commit that referenced this pull request Jul 23, 2018
…las-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

[Form] fix truncating form views in data collector

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no (fixing a non released patch)
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Fixes #27923.

Commits
-------

5fa1f12 [Form] fix truncating form views in data collector
This was referenced Jul 23, 2018
VincentChalnot pushed a commit to VincentChalnot/SidusBaseBundle that referenced this pull request Nov 28, 2018
Improved Form event bubbling symfony/symfony#8834 (comment)
Removing custom code fixed by symfony/symfony#27923
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.

7 participants