Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tom 713 posts 954 karma points
    Sep 08, 2011 @ 04:35
    Tom
    0

    protected nodes = SLOW?

     @foreach (var item in indexNode.Children.Where("Visible"))
        {
          if(!item.IsProtected || (item.IsProtected && item.HasAccess))
          {
            selectedItem = Array.IndexOf(Model.Path.Split(','), item.Id.ToString()) >= 0 ? "current" : "";
            <li class="@Html.Raw(selectedItem)">
              <href="@item.Url">@item.Name</a>
            </li>
            selectedItem = "";
          }
        }

    Hi All having some issues with performance when using isprotected and hasaccess to check the security around a node.. i find any time I use those my load times on the page's blows out to around 1-3 seconds per macro using these calls.. just wondering if anyone had had any insights in to speeding this up?

  • Tom 713 posts 954 karma points
    Sep 08, 2011 @ 05:26
    Tom
    0
    umbracoMacro Begin UL Post Auth 4.30763909938274 0.000035
    umbracoMacro End SideNav UL 5.43301955974852

    1.125380

     

     

     

    Here's my trace with HasAccess using this macro script:

     <ul id="nav-list">
        @if (HttpContext.Current.User.Identity.IsAuthenticated)
      {
     HttpContext.Current.Trace.Write("umbracoMacro""Begin UL Post Auth");
          <li class="home"><href="/">Home</a></li>

          <li class="divider">&nbsp;</li>
      }
        @foreach (var item in indexNode.Children.Where("Visible"))
      {
        if (item.HasAccess)
        {
          if (item.NodeTypeAlias == "externalLink")
          {

          <li><href="@item.externalLink"@GetLinkTarget(@item)>@item.Name</a></li>
          }
          else
          {
            selectedItem Array.IndexOf(Model.Path.Split(',')item.Id.ToString()>= "current" "";

          <li class="@Html.Raw(selectedItem)"><href="@item.Url">@item.Name</a</li>
          }

          <li class="divider">&nbsp;</li>
          selectedItem "";

        }
      }
     @{HttpContext.Current.Trace.Write("umbracoMacro""End SideNav UL");}
        @if (Array.IndexOf(Model.Path.Split(',')jobsNode.Id.ToString()>= 0)
      {
        selectedItem "current";
      }
        <li class="@Html.Raw(selectedItem)"><href="@jobsNode.Url">@jobsNode.Name</a></li>
        <li class="divider">&nbsp;</li>
      </ul>


  • Tom 713 posts 954 karma points
    Sep 08, 2011 @ 05:27
    Tom
    0

    Without HasAccess

    umbracoMacro Begin UL Post Auth 4.451236400157 0.000054
    umbracoMacro End SideNav UL 4.51223661107766 0.061000
  • Sebastiaan Janssen 5058 posts 15520 karma points MVP admin hq
    Sep 12, 2011 @ 17:47
    Sebastiaan Janssen
    0

    I don't have this problem (0.04 seconds here):

    umbracoMacro Begin check IsProtected 0,458824468078062 0,024057
    umbracoMacro Begin check IsProtected 0,498483060734514 0,039659

    I am running the latest nightly of Razor engine though, that might have performance improvements. Grab a recent nightly and copy the umbraco.MacroEngines.dll over to your bin folder.

  • Sebastiaan Janssen 5058 posts 15520 karma points MVP admin hq
    Sep 12, 2011 @ 17:47
    Sebastiaan Janssen
    0

    By the way: Wow, really, your pages have more than 4 seconds of load time already?! What is going on there, that's a loooong time. Are you running on SQL CE maybe?

Please Sign in or register to post replies

Write your reply to:

Draft