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?
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.
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?
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)">
<a 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?
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"><a href="/">Home</a></li>
<li class="divider"> </li>
}
@foreach (var item in indexNode.Children.Where("Visible"))
{
if (item.HasAccess)
{
if (item.NodeTypeAlias == "externalLink")
{
<li><a href="@item.externalLink"@GetLinkTarget(@item)>@item.Name</a></li>
}
else
{
selectedItem = Array.IndexOf(Model.Path.Split(','), item.Id.ToString()) >= 0 ? "current" : "";
<li class="@Html.Raw(selectedItem)"><a href="@item.Url">@item.Name</a> </li>
}
<li class="divider"> </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)"><a href="@jobsNode.Url">@jobsNode.Name</a></li>
<li class="divider"> </li>
</ul>
Without HasAccess
I don't have this problem (0.04 seconds here):
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.
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?
is working on a reply...