Skip to content

Conversation

@alinceDev
Copy link

Q A
Bug fix? no
New feature? no
Docs? no
Issues -
License MIT

This PR removes the component object dumping from the Symfony UX Twig Component profiler to address memory consumption issues.

IMHO, the component dump is not necessary in the profiler as it can be quite verbose and memory-intensive. When detailed component inspection is needed, it's preferable to dump the component manually in the specific context where debugging is required.

Copy link
Member

@Kocal Kocal left a comment

Choose a reason for hiding this comment

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

WDYT @kbond?

@smnandre
Copy link
Member

@alinceDev

So i checked on the project I work on and .... I'm not a big fan of this idea (but not against the idea of not storing the components ... but)

Multiple data are only visible here in the profiler... and basic scalar data is not something that would take that much memory (at all).

Could you maybe create a repository / share some code (or context) to understand what numver of components (or what amount of inner data) becomes a problem in dev for you ?

I'd rather we change profiling and remove an important feature of it only if we have a concrete example to base this choice on....

@smnandre smnandre added the Status: Waiting feedback Needs feedback from the author label Sep 20, 2025
@Kocal Kocal removed the Status: Reviewed Has been reviewed by a maintainer label Oct 9, 2025
@Kocal
Copy link
Member

Kocal commented Oct 15, 2025

Since having components dumps in the profiler is useful but could become a mess on memory usage when having too much components, what about introducing a new option profile_components (aside the already existing option profiler)?

This option could be true by default, but in the recipe it could be configured to false with a comment explaining the possible performance issues.
WDYT?

@smnandre
Copy link
Member

Since having components dumps in the profiler is useful but could become a mess on memory usage when having too much components, what about introducing a new option profile_components (aside the already existing option profiler)?

This option could be true by default, but in the recipe it could be configured to false with a comment explaining the possible performance issues. WDYT?

100%, something I suggested here but forgot to move back here (my bad)

@Kocal
Copy link
Member

Kocal commented Oct 27, 2025

Status: Needs work

@carsonbot carsonbot added Status: Needs Work Additional work is needed and removed Status: Waiting feedback Needs feedback from the author labels Oct 27, 2025
@alinceDev alinceDev force-pushed the twig-component-profiler branch from 600e66f to 6da25e6 Compare November 2, 2025 16:00
@carsonbot carsonbot added Status: Needs Review Needs to be reviewed and removed Status: Needs Work Additional work is needed labels Nov 2, 2025
@alinceDev alinceDev force-pushed the twig-component-profiler branch 2 times, most recently from ac7093d to 21d69fc Compare November 2, 2025 16:03
@alinceDev
Copy link
Author

I updated the PR @smnandre @Kocal

@alinceDev alinceDev force-pushed the twig-component-profiler branch from 21d69fc to 36c66b4 Compare November 2, 2025 16:05
->args([
service('ux.twig_component.component_logger_listener'),
service('twig'),
param('ux.twig_component.profiler_dump_components'),
Copy link
Member

Choose a reason for hiding this comment

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

I would use an abstract arg here, and define the parameter on the definition after the load(debug.php) in the extension class... not sure we should create a parameter here

$defaults = [];
}
$container->setParameter('ux.twig_component.component_defaults', $defaults);
$container->setParameter('ux.twig_component.profiler_dump_components', $config['profiler_dump_components']);
Copy link
Member

Choose a reason for hiding this comment

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

I would remove this then :)

Comment on lines +223 to +226
->booleanNode('profiler_dump_components')
->info('Enables the dump components for Twig Component (in debug mode)')
->defaultValue('%kernel.debug%')
->end()
Copy link
Member

Choose a reason for hiding this comment

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

defaultTrue() seems more logical here .. (its not just in debug mode but... when twig component profiler is enabled)

Without the parenthesis, probably something like

"Dump components in the Twig Component profiler panel"

wdyt ?

@smnandre
Copy link
Member

smnandre commented Nov 3, 2025

Also could you add a tests or two, you can find similar ones in tests/Unit/DependencyInjection/TwigComponentExtensionTest.php and tests/Unit/DataCollector/TwigComponentDataCollectorTest.php

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.

5 participants