Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

TagHelperExecutionContext must be smart about new TagHelper Content allocations. #317

Closed
sornaks opened this issue Mar 4, 2015 · 2 comments
Assignees
Milestone

Comments

@sornaks
Copy link

sornaks commented Mar 4, 2015

Quoting Taylor's comment:

You'll have to add a bit more to make the copying work as expected/performantly. The generated code that calls into this method looks like:

if (__tagHelperExecutionContext.Output.IsContentModified)
{
    Write(__tagHelperExecutionContext.Output.GenerateContent());
}
else if (__tagHelperExecutionContext.ChildContentRetrieved)
{
    Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
}
else
{
    __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
}

So in the case that the user retrieved the child content: __tagHelperExecutionContext.ChildContentRetrieved you will end up copying the result again before writing it (no bueno).

Now it's also important to re-copy each time the GetChildContentAsync method is called so multiple TagHelper authors can see the original content (without worrying about someone else modifying it); you have this part covered.

You'll need to add a capability to retrieve the original, uncopied version for the page to use in the else if (__tagHelperExecutionContext.ChildContentRetrieved) clause.

@rynowak
Copy link
Member

rynowak commented Mar 4, 2015

The work item here is really to profile our new changes and see what still lights up as a hotspot for allocations and copying. The comments linked here called out a case that we might want to optimize, but the work that we need to do is much broader than what's called out above.

@danroth27 danroth27 added this to the 4.0.0-rc1 milestone Mar 4, 2015
@danroth27 danroth27 modified the milestones: 4.0.0-rc1, 4.0.0 Mar 19, 2015
@danroth27 danroth27 modified the milestones: 4.0.0-beta5, 4.0.0-beta6 May 18, 2015
@Eilon Eilon modified the milestones: 4.0.0-beta6, 4.0.0-beta7 Jun 29, 2015
@Eilon
Copy link
Member

Eilon commented Aug 12, 2015

Covered by #358.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants