Go to file
Ryan Nowak 42acfe43ad Fix aspnet/Mvc#3196 Razor Compilation Allocations
This change significantly reduces the amount of string and List<ISymbol>
allocations that occur during compilation by changing the way
LiteralChunks are combined.

This is a low impact fix that addresses the performance issue, the design
issues that caused it still exist.

The problem here lies in what Razor fundamentally does - it parses HTML/C#
into tokens, and then combines them back into 'chunks' a representation
friendly to code generation. When presenting with a large block of static
HTML, Razor parses it into individual HTML tokens, and then tries to join
them in back into a single chunk for rendering. Due to details of Razor's
representation of chunks/tokens, the process of combining literals is too
expensive.

Mainly, what's done here is to not try to combine instances of
LiteralChunk. The process of merging them is too expensive and requires
lots of interm List<ISymbol> and string allocations.

Instead we produce a new 'chunk' ParentLiteralChunk, which doesn't do so
much up-front computing. Various pieces of the code that deal with
LiteralChunk need to be updated to deal with ParentLiteralChunk also,
which is the bulk of the changes here.

Note that we still have the potential for LOH allocations to occur during
codegen, but it's likely to occur O(1) for each large block of HTML
instead of O(N) as it did in the old code.
2015-11-18 12:51:11 -08:00
src Fix aspnet/Mvc#3196 Razor Compilation Allocations 2015-11-18 12:51:11 -08:00
test Fix aspnet/Mvc#3196 Razor Compilation Allocations 2015-11-18 12:51:11 -08:00
tools Strong name everything. 2015-11-02 14:56:23 -08:00
.gitattributes
.gitignore
.travis.yml Small .travis.yml update: Consolidate `brew` commands under a single `if` 2015-11-17 14:56:16 -08:00
CONTRIBUTING.md
LICENSE.txt
NuGet.config
NuGetPackageVerifier.json
README.md
Razor.sln
appveyor.yml
build.cmd
build.sh
global.json
makefile.shade

README.md

Razor

AppVeyor: AppVeyor

Travis: Travis

The Razor syntax provides a fast, terse, clean and lightweight way to combine server code with HTML to create dynamic web content. This repo contains the parser and the C# code generator for the Razor syntax.

This project is part of ASP.NET 5. You can find samples, documentation and getting started instructions for ASP.NET 5 at the Home repo.