- Simplify things that used to rely on HtmlTextWriter. This behavior is
now the default.
- Simplify a whole mess of Razor TextWriter code.
- Integration test for merging of TagHelper buffers back into the 'main'
buffer.
This change removes a layer of abstraction. These validators now just do
what they do now without creating a bunch of intermediate objects.
ModelClientValidationRule has been removed, and client validations
manipulate the attributes collection of a tag directly.
These changes are aimed at significantly improving the performance of
MVC/Razor when a large amount of content is in play or a large number of
TagHelpers are used.
A few issues addressed:
- Buffer sync writes after a flush has occurred so that we can write them
asyncronously. The issue is that an IHtmlContent can only do sync
writes. This is very bad for Kestrel in general. Doing these writes
async is better for our overall perf, and the buffer that we use for it
is from the pool.
- 'Flatten' ViewBuffers when possible. A page with lots of TagHelpers can
end up renting a ViewBuffer and only write 2-3 things into it. When a
ViewBuffer sees another ViewBuffer we can either steal its pages, or
copy data out and 'return' its pages. This lets us use 3-4 buffers for a
large Razor page instead of hundreds.