-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Precompile razor views #1178
Precompile razor views #1178
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might not be set. The relative path is file.Path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Internal API, it's set when you call it. Hence the assert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's wrong in general though. You should never use the PhysicalPath to make decisions. It might be null. Why you need it anyways?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you get a path of a file you enumerated? Build it up from the folder? Even if it's guaranteed to come from a Physical file system?
to precompile razor pages. This is limited to sites where the .cshtml are still deployed. It's current purpose is to speed up startup. Deploying without the razor files is a separate feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be using Crc32 here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have a followup item, see the description of the PR
01e97c8 to
130e1f9
Compare
|
I have a couple more renames and basic tests for compiler cache coming. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already gone in the next iteration :) good catch!
Remove relative path computation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return types.Where(Match)
.Select((RazorFileInfoCollection)Activator.CreateInstance(collectionType);Doesn't seem like there's much benefit in mixing Linq and yield returns. Also isn't there an Activator.CreateInstance<T>?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, this was left behind for easy debugging (similar to the other area in match), but since if it fails it will fail in match (if at all), it is a good idea to simplify.
Activator.CreateInstance doesn't take a type as input so its useless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be called Checksum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its really fingerprint :) potatos/potatos going to leave as is unless you have strong opinion on this
Simplify CacheEntry Move figuring out class name to GeneratorResultExtensions Cleanup
|
|
This is the initial code (beta) to support pre compiling razor views and providing a caching mechanism.
The intent for this implementation is to speed up first start by avoiding jitting of Razor and Roslyn when you don't ship .cs files in the app.
There are several followup issues (mostly RC or later):
2.1 Change files - supported
2.2 Delete files - supported
2.3 Delete/Change viewstart - not supported
2.4. File watcher support
2.5. Integrate with in memory cache - requires view start feature, and changes to memory cache.
5.1 for C# errors - supported
5.2 for Razor parsing errors - not supported (but VS will show up when you open the file).