Back to Devexpress

How To: Improve View Rendering Speed

aspnetmvc-403773-troubleshooting-performance-issues-how-to-improve-view-rendering-speed.md

latest1.8 KB
Original Source

How To: Improve View Rendering Speed

  • Jun 21, 2024
  • 3 minutes to read

This topic complements the How to: Improve page rendering speed topic and contains information specific to DevExpress ASP.NET MVC Extensions.

Optimize Resources

DevExpress ASP.NET MVC project templates register styles and scripts for all available suites. This reduce the View render speed.

csharp
@Html.DevExpress().GetStyleSheets(  
    new StyleSheet { ExtensionSuite = ExtensionSuite.NavigationAndLayout },  
    ...  
    new StyleSheet { ExtensionSuite = ExtensionSuite.TreeList }  
)  

@Html.DevExpress().GetScripts(  
    new Script { ExtensionSuite = ExtensionSuite.NavigationAndLayout },  
    ...  
    new Script { ExtensionSuite = ExtensionSuite.TreeList }  
)

Do any of the following to resolve the issue:

  • Exclude the links to resources for unused suites.

  • Include styles and scripts in specific Views only.

Optimize Callback Management

When the total request/response cycle duration is too long, use the following technique to diagnose the issue:

cshtml
public ActionResult MeasuredActionMethod() {  
    System.Diagnostics.Stopwatch sw = System.Diagnostics.Stopwatch.StartNew();  

    // Execute your operations here 

    sw.Stop();  
    ViewData["Duration"] = sw.ElapsedMilliseconds.ToString();  
    return View();  
}
cshtml
@ViewData["Duration"]
  • Use a browser’s DevTools -> Network profiler to measure the total request duration.