Poor performance with in EmbeddedViewsVirtualPathProvider #1151

Imported from the CodePlex archive for reference purposes. Support for MvcCodeRouting has ended.

Reported on

When I using EmbeddedViewsVirtualPathProvider for getting views from assembly resources provider has poor performance in MVC 4. Issue is in methods DirectoryExists and FileExists becouse when check for virtualPah/Dir that exists its OK but check for file witch isnt exist it tooks time. When I have Editor/DisplayTemplate for decimal MVC 4 try to find view like decimal.Mobile decimal.Table etc.. Becouse this files doesnt exists (but decimal.cshtml yes) cache is not hit. If I have 100 editors in page and every check tooks about 80ms, whole view is rendered in 8s.

If in methods FileExists and DirectoryExists will be falseCache for missing entries it will perform better.

Thanks

Commented on link

Thanks for reporting the issue. I need more clarification though.

What happens when you don’t enable embedded views? How long does it take for the same view to render? Assuming the same embedded files exists in the file system.

Commented on link

I dont know. If I disable all DisplayModesProvider except default (“” empty string) my view is rendered in 200ms with mobile displayMode about 3s (I mesure with IE developer tools in network pane).

Commented on link

Are you running with debug disabled? <compilation debug="false">

Commented on link

I’m not clear if this is an issue with MvcCodeRouting or MVC itself. In FileExists and DirectoryExists I’m first calling the filesystem provider, which would be the same behavior if embedded views was not enabled.

If you could send me a project that reproduces the issue I’d be happy to investigate further.

Commented on link

I try to remove debug attribute from web.config compilation element. After it works good and in full speed. I think problem is somewhere in MVC in debug mode. If I have editor template for decimal in embeded views MVC try to find decimal.mobile.cshtml in embeded view too. May be becouse directory exists and default template was founded.

I think you can close this issue.

Commented on link

MVC caches view location results, but only if <compilation debug="false">.