Skip to content

[AssetMapper] Fixing memory bug where we stored way more file content than needed #52330

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

Conversation

weaverryan
Copy link
Member

Q A
Branch? 6.4
Bug fix? yes (on Symfonycasts, without this, asset-map:compile takes >500mb of memory)
New feature? no
Deprecations? none
Issues None
License MIT

Hi!

This drastically improves the memory footprint when ALL assets are built, which happens in asset-map:compile, debug:asset-map, etc. Blackfire is a huge fan! https://blackfire.io/profiles/compare/4eb36732-8805-4c49-b636-d4bf8f9e2b27/graph

The MAIN optimization by far is to set MappedAsset.content to null if the final, compiled content matches the source file's content. This is the case for the vast-majority of mapped assets, and so the result is MUCH less content stored in memory for no reason.

Thanks to @smnandre and his earlier PR, which allows for the null content on mapped assets.

Cheers!

@nicolas-grekas
Copy link
Member

Thank you @weaverryan.

@nicolas-grekas nicolas-grekas merged commit 415ad8c into symfony:6.4 Oct 27, 2023
@weaverryan weaverryan deleted the asset-mapper-memory-improvement branch October 27, 2023 16:24
This was referenced Oct 29, 2023
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.

4 participants