Then the selection.Any() can use the selection.Length internally, and the ordering is already performed the first time around, as I remember it the Model.Ancestors also returns in an ordered list by level, to if you need to reverse the order, you could also just perform an .Reverse() if you want the breadcrumb to be reversed.
The above are small things but they might help.
Do you have any menu generation running in the master.cshtml or head.cshtml, that isn't included in the above examples, as menu generation is usually the problem in sites with a larger amount of nodes.
They might benefit from the same optimization as described above, or look into output caching for the generated menues.
HtmlHelpers.GetPage(CurrentPage: Model, ContentTypeAlias: "DocHome") (it is used not only to get the main page, but also to get the category page from any level of the subcategory):
/// <summary>
/// Получение страницы в зависимости от дочерней страницы
/// </summary>
/// <param name="CurrentPage">Текущая страница</param>
/// <param name="ContentTypeAlias">Псевдоним типа контента страницы</param>
/// <returns></returns>
public static IPublishedContent Get_Page(IPublishedContent CurrentPage, string ContentTypeAlias)
{
IPublishedContent Get(IPublishedContent item)
{
if (item == null)
{
return null;
}
if (item.ContentType.Alias == ContentTypeAlias)
{
return item;
}
return Get(item.Parent);
}
return Get(CurrentPage);
}
[v8] Bug. A page with a single field starts to work slower when the site is enlarged
Hello
EN: A page with a single field starts to work slower when the site is enlarged
RU: Страница с одним полем начинает работать медленнее при увеличении сайта
Examples (Umbraco 8.2.2 + SQL Server 2019):
EN: The site is very fast at first, but slows down with the growth of pages. (he functionality of the page does not change, but slows down over time)
RU: Сайт сначала очень быстрый, но замедляется с ростом страниц. (Функционал страницы не меняется, но со временем замедляется)
https://github.com/umbraco/Umbraco-CMS/issues/7329
Hi Vlad
Can you, please, share the source code of the page? Maybe something can be fixed in code.
Thanks,
Alex
Contacts:
_Breadcrumb:
Main_Title:
RU: Если что-то еще требуется, напишите, пожалуйста.
EN: Is there anything else you need to clarify?
Hi Vlad
Thanks, the code looks good, shouldn't be a problem. Try to use MiniProfiler to identify what is taking the time, MiniProfiler documentation is here - https://our.umbraco.com/documentation/getting-started/Code/Debugging/
I will ask friends what it can be in Umbraco version 8.2.
Thanks, Alex
A good practice is to execute IEnumerables up front.
In this case you have the following IEnumerables
IEnumerable<IPublishedContent> selection = Model.Ancestors();
selection.Any()
selection.OrderBy(p => p.Level)
This can be written as
then the collection build upfront.
Then the selection.Any() can use the selection.Length internally, and the ordering is already performed the first time around, as I remember it the Model.Ancestors also returns in an ordered list by level, to if you need to reverse the order, you could also just perform an .Reverse() if you want the breadcrumb to be reversed.
The above are small things but they might help.
Do you have any menu generation running in the master.cshtml or head.cshtml, that isn't included in the above examples, as menu generation is usually the problem in sites with a larger amount of nodes.
They might benefit from the same optimization as described above, or look into output caching for the generated menues.
Hi Alex
Thanks
--
Hi Thomas
Thanks
--
MainText.cshtml:
_master.cshtml:
_Header.cshtml:
HtmlHelpers.GetPage(CurrentPage: Model, ContentTypeAlias: "DocHome") (it is used not only to get the main page, but also to get the category page from any level of the subcategory):
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.