AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
DAX
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 07.12.2022, 17:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
sashanazarov: D365FO: Bypassing "next" in CoC
Источник: http://sashanazarov.blogspot.com/202...xt-in-coc.html
==============

DISCLAIMER: Use this trick at your own risk. Do not do this, unless you absolutely have to.

Some time ago I had to figure out why one of the custom services was slow. It took like 30+ seconds to return a dozen of trade agreements for a customer.

It turned out the SysExtension framework tried to collect data about classes through reflection, and it did that multiple times in the same session.

The issue may be reproduced with this runnable class. Here, we instantiate instances of 4 different classes. The class constructors use SysExtension framework for figuring out which class type to build.



If running the class the first time, the output would look something like this:

SalesLineType::construct: 13610 ms
SalesSummaryFields::construct: 1968 ms
SalesQuantity::construct: 2078 ms
TradeModuleType::newFromModule: 3406 ms


After System administration -> Setup -> Refresh elements, the time would drop to:


SalesLineType::construct: 1735 ms
SalesSummaryFields::construct: 1781 ms
SalesQuantity::construct: 1641 ms
TradeModuleType::newFromModule: 1656 ms



But still, almost 2 seconds for every single class instance is too much.


The following change can fix this issue by skipping metadata collection, if it is already done:




This code does the following: if the reflection is already collected (reflectionDataEnumerator.moveNext() returns "true"), we throw an exception of a type, that will most likely never be thrown from the "next populateFromMetadata();" itself. Then, we catch the exception, but that also means the "next" statement is skipped and the reflection cache data is not built from scratch again.


After this change, the runnable class output looks like this:


SalesLineType::construct: 1657 ms
SalesSummaryFields::construct: 218 ms
SalesQuantity::construct: 125 ms
TradeModuleType::newFromModule: 157 ms

It is important, that this "skip" is only done when there is no transaction scope around, otherwise it would abort the transaction, therefore the check for ttsLevel. So, this trick will basically improve performance of certain "read" scenarios, but in order to improve performance for "write" scenarios, MS has to provide a fix.



Источник: http://sashanazarov.blogspot.com/202...xt-in-coc.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
d365technext: Form Data Source Method override COC D365FO Blog bot DAX Blogs 0 02.11.2018 14:11
palleagermark: Important caveat with the "Chain of command" (CoC) feature Blog bot DAX Blogs 1 06.09.2017 16:49
D365FO - Ошибка "A valid value for parameter "PSAVendorTxt" does not exist" при предварительном просмотре заказа на покупку MarinaAX DAX: Программирование 3 05.09.2017 17:48
Platform updates overview - 3.70.B - NAV2009 R2 Blog bot Dynamics CRM: Blogs 0 07.02.2011 22:06
dynamicsusers: Belgian MSDN/TechNet Evenings on Dynamics NAV - NEXT: "SharePoint Server" and "Employee Portal" Blog bot Dynamics CRM: Blogs 0 13.12.2007 10:44
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 17:29.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.