forked from dotnet/aspnetcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use view buffers during pre-rendering (dotnet#39465)
* Use view buffers during rendering This change removes about 8kb of string[] allocations per request during pre-rendering and replaces them with a ViewBuffer that uses array pooling. The allocations come from list resizing as part of HtmlRenderer operations (such as https://github.com/dotnet/aspnetcore/blob/main/src/Mvc/Mvc.ViewFeatures/src/RazorComponents/HtmlRenderer.cs#L133-L134). Also includes a couple of other clean up items: * Uses ValueTask instead of `Task<T>` * Moves top-level types to a separate file. * Some formatting cleanup
- Loading branch information
1 parent
82e29e4
commit 1c2e945
Showing
16 changed files
with
210 additions
and
233 deletions.
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
src/Components/Server/test/Microsoft.AspNetCore.Components.Server.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
src/Mvc/Mvc.ViewFeatures/src/Infrastructure/ComponentHtmlContent.cs
This file was deleted.
Oops, something went wrong.
8 changes: 5 additions & 3 deletions
8
src/Mvc/Mvc.ViewFeatures/src/RazorComponents/ComponentRenderedText.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Microsoft.AspNetCore.Html; | ||
|
||
namespace Microsoft.AspNetCore.Components.Rendering; | ||
|
||
internal readonly struct ComponentRenderedText | ||
{ | ||
public ComponentRenderedText(int componentId, IEnumerable<string> tokens) | ||
public ComponentRenderedText(int componentId, IHtmlContent htmlContent) | ||
{ | ||
ComponentId = componentId; | ||
Tokens = tokens; | ||
HtmlContent = htmlContent; | ||
} | ||
|
||
public int ComponentId { get; } | ||
|
||
public IEnumerable<string> Tokens { get; } | ||
public IHtmlContent HtmlContent { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.