Are nested layouts in Razor slow?

I have a pretty simple nested layout.

  • _Layout defines all the global stuff.
    • site.css
    • JQuery
    • basic HTML
  • _2ColLayout does just that. Makes _Layout design 2Col

When I use _Layout, the page rendering time (as shown in MiniProfiler) is about 66 ms. Oddly enough, when I use _2ColLayout, which jumps to 250ms. HTML is not so complicated. Am I crazy or has anyone else seen this? Is the work known?

I removed some of the static HTML to clear the snippets below. I doubt it, because they are just list items, anchors, images, and more.


_layout

<head>
    @this.InitClientTimings()
    <title>@Page.Title</title>
    @this.TimeScript("Content Bootstrap.css", @<link  href="@Url.Content("~/Components/bootstrap/bootstrap.css")" rel="stylesheet" type="text/css"/>)
    @this.TimeScript("GoogleFont.css", @<link href='http://fonts.googleapis.com/css?family=Days+One|Open+Sans:400&subset=latin,latin-ext' rel='stylesheet' type='text/css' />)
    @this.TimeScript("Content Site.css", @<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />)
   
    @this.TimeScript("LAB.js", @<script type='text/javascript' src="/scripts/LAB.min.js"></script>)
    <script type="text/javascript">        window.q = []; window.$ = function (f) { q.push(f); };</script>
   
</head>
<body id="bootstrap-js">
    <div class="navbar navbar-fixed-top">
        <div class="navbar-inner">
            <div class="container">
                <div class="nav-collapse">
                    <ul class="nav">
                       <!-- nav links -->
                    </ul>
                </div>
               <span class="pull-right">@Html.Action("LogOnControl", "Home")</span>
            </div>
        </div>
    </div>
    <div class="container">
        <div class="page-header">
            @RenderSection("pageheader", false)
        </div>
        <div class="row">
            @RenderBody()
        </div>
    </div>
    <footer>

    </footer>

    @RenderSection("scripts", false)
    @MiniProfiler.RenderIncludes()
    <script type="text/javascript">        $(function () { $("img.lazy").lazyload({ threshold: 50 }); $(window).scroll(); });</script>

     <script type="text/javascript">
         $LAB
        .script("http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js").wait()
        .script("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.19/jquery-ui.min.js")
        .script("http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js")
        .script("/scripts/jquery.lazyload.min.js")
        .script("/Scripts/social-endlessPage.js")
        .script("/Components/bootstrap/js/bootstrap.min.js")
        .wait(function () {
            $.each(q, function (index, f) {
                $(f)
            });
        });
    </script>
</body>

_2ColLayout

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section pageheader
{
    @RenderSection("pageheader", false)
}
<div class="span8">
    @RenderBody()
</div>
<div class="offset1 span3 rightbar">
    @if (IsSectionDefined("rightbar"))
    {
        @RenderSection("rightbar", false)
    }
    else
    {
       <!--default right bar stuff -->
    }
</div>
@section scripts
    {
    @RenderSection("scripts", false)
}
+3
source share
1 answer

You know that, it doesn't matter.

, (!), Azure. , 200 !... .

, ,

+1

All Articles