ASP.NET MVC partial views slow?

前端 未结 3 1709
走了就别回头了
走了就别回头了 2021-02-05 07:21

I just happen to check the performance of an ASP.NET MVC application we are building. I was going to insert a partial view into a loop, and just out of curiosity I checked how l

3条回答
  •  春和景丽
    2021-02-05 07:30

    I am guessing the answer is ... it depends?

    Partial views decrease performance (the overhead of the actual call etc).

    Partial views are not cached.

    Including a partial view inside a loop will decrease performance, and can be sped up again by moving the loop inside the partialview instead.

    Some sample reading (which references the caching of the viewpath) can be found here.

提交回复
热议问题