Skip to content

Conversation

@pranavkm
Copy link
Contributor

@pranavkm pranavkm commented Jan 12, 2022

ComponentFactory is instantiated on a per-renderer basis. It has a cache that stores
property initializers in a state independent way. In a Blazor server app, there is a HtmlRenderer created
during pre-rendering and a per-circuit renderer which means we're calculating (reflection) and allocating multiple
copies of property initializers. Turning it into a static avoids this.

ComponentFactory is instantiated on a per-renderer basis. It has a cache that stores
property initializers in a state independent way. In a Blazor server app, there is a HtmlRenderer created
during pre-rendering and a per-circuit renderer which means we're calculating and allocating multiple
copies of property intializers.
@ghost ghost added the area-blazor Includes: Blazor, Razor Components label Jan 12, 2022
@pranavkm pranavkm marked this pull request as ready for review January 12, 2022 04:31
@pranavkm pranavkm requested a review from a team as a code owner January 12, 2022 04:31
Copy link
Member

@SteveSandersonMS SteveSandersonMS left a comment

Choose a reason for hiding this comment

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

Well found.

@pranavkm pranavkm merged commit a429ec3 into dotnet:main Jan 18, 2022
@pranavkm pranavkm deleted the prkrishn/component-factory-cache branch January 18, 2022 14:18
@ghost ghost added this to the 7.0-preview1 milestone Jan 18, 2022
ShreyasJejurkar pushed a commit to ShreyasJejurkar/aspnetcore that referenced this pull request Jan 22, 2022
…otnet#39450)

ComponentFactory is instantiated on a per-renderer basis. It has a cache that stores
property initializers in a state independent way. In a Blazor server app, there is a HtmlRenderer created
during pre-rendering and a per-circuit renderer which means we're calculating and allocating multiple
copies of property intializers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants