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

Conversation

@yishaigalatzer
Copy link
Contributor

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):

  1. Add functional tests - blocked on project references not working with meta programming
  2. Support cache invalidation scenarios
    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.
  3. Support not deloying razor files
  4. CRC instead of MD5 hash (needs OSS approval), or alternatively Sha1 - Requires Razor changes
  5. Diagnostics
    5.1 for C# errors - supported
    5.2 for Razor parsing errors - not supported (but VS will show up when you open the file).
  6. Changes to Razor for exposing class name, namespace and hash from generator results.

@yishaigalatzer
Copy link
Contributor Author

@davidfowl @pranavkm

Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Member

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?

Copy link
Contributor Author

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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?

Copy link
Contributor Author

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

@yishaigalatzer
Copy link
Contributor Author

I have a couple more renames and basic tests for compiler cache coming.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Copy link
Contributor Author

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!

Copy link
Contributor

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>?

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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

YishaiGalatzer added 2 commits September 25, 2014 09:21
Simplify CacheEntry
Move figuring out class name to GeneratorResultExtensions
Cleanup
@pranavkm
Copy link
Contributor

:shipit:

@yishaigalatzer yishaigalatzer deleted the precompile_sample branch January 26, 2015 18:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants