6

I'm trying to tune up my MVC3 application that uses a lot of jquery libraries, including jqGrid.
I'd be interested to hear your best practices and performance tips and tricks if any. What you normally do for 'most' MVC3 based applications as a given.

Thank you

3
  • Define tuning - are you talking about code simplicity, or how fast your page can load all resources? Commented Dec 29, 2011 at 16:42
  • If you present some actual evidence of a performance metric and what you want to be improved this question will survive. For now I vote for close. Commented Dec 29, 2011 at 16:45
  • Sorry I should've elaborated. Yes, I am speaking about load times. The perceived user experience when using your web application. I am looking to see how to improve load times when you have several jquery files that are already minified + your own. Does it normally cause an application to slow down tremendously? Commented Dec 29, 2011 at 16:50

3 Answers 3

2

Description

If tune means better loading you can do these 3 things. You could optimize the loading time up to 80% with theese techniques.

I suggest to use Fiddler2 to see how your changes perform.

  1. you should compress and combine your javascript files.
  2. you should use the OutputCache Attribute if possible
  3. you should remove unused ViewEngines

Sample

  1. Combine/Compress/Minify JS and CSS files in ASP.NET MVC
  2. MSDN: OutputCacheAttribute Class

    [OutputCache(Duration=60)]
    public ActionResult Index()
    {
        return View();
    }
    
  3. do this in global.asax

    protected void Application_Start()
    {
        // other stuff
    
        ViewEngines.Engines.Clear();
    
        // if you only use RazorViewEngine
        ViewEngines.Engines.Add(new RazorViewEngine());
    
        // if you only use WebFormViewEngine
        ViewEngines.Engines.Add(new WebFormViewEngine());
    }
    

More Information

Sign up to request clarification or add additional context in comments.

2 Comments

W.r.t. jquery files, do you suggest using CDN or local versions for an application that could be intranet or internet based? What would be the effect of either one of these?
On intranet i suggest local versions because you dont need internet acces. On internet based apps you can use CDN because these networks are fast as hell (made for this) and the chance is very high that a client has these scripts already in his cache.
1

Following the Yahoo recommendations is a great way to optimize and speedup a website. Some of the tips are very easy to implement and could bring considerable performance gains.

Google have also published some great resources that I strongly invite you to read.

Comments

1

Combining and minifying your scripts is a great start to cut down the response size and number of requests. Also, be sure not to include uneccessary plugins and code that won't be used on particular pages...

Article on the topic:

http://www.hanselman.com/blog/TheImportanceAndEaseOfMinifyingYourCSSAndJavaScriptAndOptimizingPNGsForYourBlogOrWebsite.aspx

For performance tuning on the server-side check out the Mini Profiler tool created and used by SO:

http://code.google.com/p/mvc-mini-profiler/

1 Comment

Hi,Thank you for this. I have minified all my js files. I have also scaled down images if any that I use in the application.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.