RenderAction vs RenderPartial performance

According to Brad Wilson, RenderAction is slower than RenderPartial.

However, does anyone have statistics that show the difference in performance?

I am developing an application in which pages are made up of "Widgets."

I have two options:

View Level Composition

Call RenderAction for each widget. This is the easiest approach, but it means that we execute a full MVC cycle for each widget.

Controller Level Composition

Create one ViewModel for the page containing the data needed for each widget. Call RenderPartial for each widget. This is much harder to implement, but means that we will only do one MVC loop.

I tested the above approaches with 3 different widgets per page, and the difference in rendering time was 10 seconds (hardly worth worrying about).

However, did anyone get any test results more specific than this, or maybe they are testing both approaches?

+5
source share
2 answers

I would suggest two more options, both require to create a view model at the controller level, and both can work together (depending on the data)

  • Html.DisplayFor () - display templates
  • Helpers with Extension Methods

2 , , , . , , , , "" . , , ( , ).

( ..) , html , .

+3

, , , RenderAction, . , RenderAction - , , 200-300 ( ). , . , . , RenderPartial 0-10 .

RenderAction, , RenderPartial. . , , , RenderAction , , , .

: , MiniProfiler . , .

: , , , , global.asax. , RenderPartial MVC .

+3

All Articles