{"id":38571,"date":"2021-10-28T12:24:43","date_gmt":"2021-10-28T11:24:43","guid":{"rendered":"https:\/\/arquiconsult.com\/?p=38571"},"modified":"2024-10-23T13:55:27","modified_gmt":"2024-10-23T12:55:27","slug":"profiling-al-performance-with-snapshot-debugger","status":"publish","type":"post","link":"https:\/\/arquiconsult.com\/es\/profiling-al-performance-with-snapshot-debugger\/","title":{"rendered":"#010 PROFILING AL PERFORMANCE WITH SNAPSHOT DEBUGGER"},"content":{"rendered":"<div class=\"services_vertical horizontal_services row\" style=\"background-color: #f7f7f7; padding: 25px; border-radius: 5px; text-align: justify;\">\n<p style=\"font-weight: 400;\">Performance is always on our mind for us and our customers as well. Until now, we did not have a practical tool to monitor the execution time of our code and with that to help us in performance analysis. With the release of Dynamics 365 Business Central 2021 Wave 2 Release (a.k.a. BC19), Microsoft gave us the possibility to capture execution time as part of the snapshot, and enabled us to watch it in Visual Studio Code while replaying the snapshot.<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<p>In the\u00a0previous\u00a0Tips #33\u00a0(Snapshot Debugging: Run Code on Server and Debug in VS Code), we learn how to use the Snapshot Debugger. Now, with\u00a0BC19\u00a0we have a new feature added \u2013 the \u201c<strong>executionContext<\/strong>\u201d property.<\/p>\n<p><strong>This new property has the following list of options:<\/strong><\/p>\n<p><strong>1. Debug: <\/strong>No profile data is collected;<\/p>\n<p><strong>2. DebugAndProfile: <\/strong>Debug and profiling\u00a0will\u00a0occur;<\/p>\n<p><strong>3. Profile: <\/strong>Only profiles the session, ignores the snappoints.<\/p>\n<p>In the following example we used the DebugAndProfile option.<\/p>\n<p><img loading=\"lazy\" class=\"size-medium wp-image-37760 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/In-the-following-example-we-used-the-DebugAndProfile-option.-640x357.png\" alt=\"In the following example we used the DebugAndProfile option.\" width=\"640\" height=\"357\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/In-the-following-example-we-used-the-DebugAndProfile-option.-640x357.png 640w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/In-the-following-example-we-used-the-DebugAndProfile-option.-768x429.png 768w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/In-the-following-example-we-used-the-DebugAndProfile-option.-1536x857.png 1536w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/In-the-following-example-we-used-the-DebugAndProfile-option..png 1555w\" sizes=\"(max-width: 640px) 100vw, 640px\" title=\"-\"><\/p>\n<p>When the snapshot file download is completed, we can run the\u00a0<b>AL: Generate profile file\u00a0<\/b>command, and we choose the respective downloaded file.<\/p>\n<p><img loading=\"lazy\" class=\"size-medium wp-image-37763 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/AL-Generate-profile-file-command-640x274.png\" alt=\"AL Generate profile file\u00a0command,\" width=\"640\" height=\"274\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/AL-Generate-profile-file-command-640x274.png 640w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/AL-Generate-profile-file-command-768x329.png 768w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/AL-Generate-profile-file-command-1536x659.png 1536w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/AL-Generate-profile-file-command.png 1546w\" sizes=\"(max-width: 640px) 100vw, 640px\" title=\"-\"><\/p>\n<p>After this, our performance profile file will be downloaded and opened.<\/p>\n<p>Now, we are able to trace the execution triggers, procedures, events and so on.<\/p>\n<p><img loading=\"lazy\" class=\"size-medium wp-image-37766 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/we-are-able-to-trace-the-execution-triggers-640x304.png\" alt=\"we are able to trace the execution triggers\" width=\"640\" height=\"304\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/we-are-able-to-trace-the-execution-triggers-640x304.png 640w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/we-are-able-to-trace-the-execution-triggers-768x364.png 768w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/we-are-able-to-trace-the-execution-triggers-1536x729.png 1536w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/we-are-able-to-trace-the-execution-triggers.png 1566w\" sizes=\"(max-width: 640px) 100vw, 640px\" title=\"-\"><\/p>\n<p>In this last image, we can see the time in milliseconds that took our function to run, and we can now understand the impact that our solution is having on performance.<\/p>\n<!--themify_builder_content-->\n<div id=\"themify_builder_content-38571\" data-postid=\"38571\" class=\"themify_builder_content themify_builder_content-38571 themify_builder tf_clear\">\n    \t<!-- module_row -->\n\t<div  data-lazy=\"1\" class=\"module_row themify_builder_row tb_nus1581 tb_first tf_clearfix\">\n\t    \t\t<div class=\"row_inner col_align_top col-count-1 tf_box tf_w tf_rel\">\n\t\t\t<div  data-lazy=\"1\" class=\"module_column tb-column col-full first tb_cai8581 tf_box\">\n\t\t\t    \t        <div class=\"tb-column-inner tf_box tf_w\">\n\t\t    <!-- module text -->\n<div  class=\"module module-text tb_9tkr581 arquitps-data  \" data-lazy=\"1\">\n        <div  class=\"tb_text_wrap\">\n    <p><script>\njQuery(\".tbp_post_month:contains(Janeiro)\").html(\"January\");\n\njQuery(\".tbp_post_month:contains(Fevereiro)\").html(\"February\");\n\n\njQuery(\".tbp_post_month:contains(Mar\u00e7o)\").html(\"March\");\n\n\njQuery(\".tbp_post_month:contains(Abril)\").html(\"April\");\n\n\njQuery(\".tbp_post_month:contains(Maio)\").html(\"May\");\n\n\njQuery(\".tbp_post_month:contains(Junho)\").html(\"June\");\n\n\njQuery(\".tbp_post_month:contains(Julho)\").html(\"July\");\n\njQuery(\".tbp_post_month:contains(Agosto)\").html(\"August\");\n\njQuery(\".tbp_post_month:contains(Setembro)\").html(\"September\");\n\njQuery(\".tbp_post_month:contains(Outubro)\").html(\"October\");\n\njQuery(\".tbp_post_month:contains(Novembro)\").html(\"November\");\n\njQuery(\".tbp_post_month:contains(Dezembro)\").html(\"December\");\t\n\n\n\n<\/script><\/p>    <\/div>\n<\/div>\n<!-- \/module text -->\t        <\/div>\n\t    \t<\/div>\n\t\t    <\/div>\n\t    <!-- \/row_inner -->\n\t<\/div>\n\t<!-- \/module_row -->\n\t\t<!-- module_row -->\n\t<div  data-anchor=\"sucesso\" data-hide-anchor=\"1\" data-lazy=\"1\" class=\"module_row themify_builder_row sucesso repeat tb_has_section tb_section-sucesso tb_n8zy66 tf_clearfix\" >\n\t    \t\t<div class=\"row_inner col_align_top col-count-1 tf_box tf_w tf_rel\">\n\t\t\t<div  data-lazy=\"1\" class=\"module_column tb-column col-full first tb_4s8z66 tf_box\">\n\t\t\t    \t        <div class=\"tb-column-inner tf_box tf_w\">\n\t\t    <!-- module buttons -->\n<div  class=\"module module-buttons tb_gune66 buttons-horizontal transparent popmake-24705 large circle tf_textc\" data-lazy=\"1\">\n    \t<div class=\"module-buttons-item tf_inline_b\">\n\t\t\t\t\t\t\t<a href=\"#\" class=\"ui builder_button tb_default_color\" >\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"tf_inline_b tf_vmiddle\">Give as a Feedback and Suggest Questions<\/span>\n\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t    \t<\/div>\n\t<\/div>\n<!-- \/module buttons -->\n\t        <\/div>\n\t    \t<\/div>\n\t\t    <\/div>\n\t    <!-- \/row_inner -->\n\t<\/div>\n\t<!-- \/module_row -->\n\t<\/div>\n<!--\/themify_builder_content-->\n","protected":false},"excerpt":{"rendered":"<p>Performance is always on our mind for us and our customers as well. Until now, we did not have a practical tool to monitor the execution time of our code and with that to help us in performance analysis. With the release of Dynamics 365 Business Central 2021 Wave 2 Release (a.k.a. BC19), Microsoft gave [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":37979,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2065],"tags":[2088,2091],"acf":[],"_links":{"self":[{"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/posts\/38571"}],"collection":[{"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/comments?post=38571"}],"version-history":[{"count":0,"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/posts\/38571\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/media\/37979"}],"wp:attachment":[{"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/media?parent=38571"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/categories?post=38571"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/tags?post=38571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}