This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Make HTML rendering deferred (IHtmlContent) #830
Comments
@pranavkm could you clarify the issue? Are you seeing poor performance numbers for a scenario involving templates read from disk? Also
|
I did not profile this in any way, but noticed this when I was looking at https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNet.Mvc.Razor/RazorTextWriter.cs. The intent of introducing that type was to avoid creating large strings in memory.
if (defaultActions.TryGetValue(viewName, out defaultAction))
{
var result = defaultAction(MakeHtmlHelper(_viewContext, _viewData));
return new HelperResult(writer => writer.Write(result));
} |
If a template ever renders a large portion of text > 80K there is definitely a major LOH issue that will cause pauses and lots of CPU spent in GC |
@NTaylorMullen please tie this to the TagHelper Content change when working with @sornaks |
Note to self: Move |
danroth27
changed the title
TemplateRenderer should return a HelperResult (Action<TextWriter>)
Make HTML rendering deferred (IHtmlContent)
Jul 16, 2015
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Currently
TemplateRenderer.Render
returns a string which gets converted to HtmlString. This causes it to produce a new StringWriter buffer. We could have it return a HelperResult instead - it's consumed in the same way, but would avoid the extra buffer allocation.The text was updated successfully, but these errors were encountered: