I just started today to use MVC T4 and I really want to keep using, but there’s something that is annoying me.
My application is quite big, so I was wondering whether MVC T4 will harm the performance of my ASP.NET MVC application.
Can I rely on MVC T4?
Thanks in advance.
You should not worry about the ammount of code that gets generated. The .NET runtime is designed to efficiently crunch through a lot more than what T4MVC generates.
Instead, you should only worry about the impact that the generated syntactic “sugars” have on the runtime behavior of the MVC application. Specifically I’m talking about a case where using a t4mvc pattern might force MVC to use a less efficient way of achieving some functionality. (A hypothetical example of this would be where doing
return View(Views.InvalidOwner);would be less efficient thanreturn View("InvalidOwner");)After looking through the samples page I can’t see anything that would stand out as a risk. However, if you are worried you should certainly measure the performance of your application. Take a look at this video as it provides some great information on how (and even if) to do performance optimization of MVC applications.