{"id":338,"date":"2022-02-15T05:12:26","date_gmt":"2022-02-15T13:12:26","guid":{"rendered":"https:\/\/blog.mozilla.org\/performance\/?p=338"},"modified":"2022-02-15T05:12:26","modified_gmt":"2022-02-15T13:12:26","slug":"performance-tools-newsletter-q4-2021","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/performance\/2022\/02\/15\/performance-tools-newsletter-q4-2021\/","title":{"rendered":"Performance Tools Newsletter (Q4 2021)"},"content":{"rendered":"<p>As the Perf-Tools team, we are responsible for the<a href=\"https:\/\/profiler.firefox.com\/\"> Firefox Profiler<\/a>. This newsletter gives an overview of the new features and improvements we\u2019ve done in Q4 2021.<\/p>\n<p>You can find the previous newsletter<a href=\"https:\/\/blog.mozilla.org\/performance\/2021\/11\/15\/performance-tools-newsletter-q3-2021\/\"> here<\/a> which was about the Q3 2021. With this newsletter, I will be writing about the things we\u2019ve done in the Q4 2021. I hope you\u2019ll enjoy the work that we\u2019ve done this quarter.<\/p>\n<p>Here are some highlights.<\/p>\n<h2>Source view for C++ \/ Rust code<\/h2>\n<p>Firefox Profiler is a great tool for providing performance analysis in relation to how long each function took. However, once a slow function is found, it is important to be able to dive in right away and figure out what is going on. Previously, it wasn\u2019t possible to do this, but with this work, now you can see the source of C++ and Rust code in a view. All you need to do is to double click on a frame on Call Tree or Flame Graph panels. A new panel at the bottom will appear and show you the function you clicked. Here\u2019s an example screenshot:<\/p>\n<p><a href=\"http:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-source-view.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-339\" src=\"http:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-source-view.png\" alt=\"Firefox Profiler Source view that appears at the bottom side of the window when a call stack is double clicked.\" width=\"1796\" height=\"1224\" srcset=\"https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-source-view.png 1796w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-source-view-300x204.png 300w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-source-view-600x409.png 600w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-source-view-768x523.png 768w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-source-view-1536x1047.png 1536w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-source-view-1000x682.png 1000w\" sizes=\"(max-width: 1796px) 100vw, 1796px\" \/><\/a>Also, <a href=\"https:\/\/share.firefox.dev\/3670KiD\">here\u2019s a link to an example profile if you are curious<\/a>. This was tremendous work and it\u2019s great that this can be used by our users now. I would like to thank Markus Stange especially for implementing this.<\/p>\n<h2>Support for inline call stacks<\/h2>\n<p>Whenever the compiler was inlining a function call away, we were completely losing information about the fact that it was that call that took up time, because we didn\u2019t have inline stacks support. We only could see the time in the parent call node. This meant that we weren\u2019t displaying the correct information to our users. Now with this work, we are not lying about the functions that take time anymore. It also displays an inline badge on the left side of a sample, so you can see that this function was inlined. <a href=\"https:\/\/share.firefox.dev\/3nGWbSr\">Here\u2019s an example profile link if you are curious<\/a>. Currently it works for only local builds, but in the future it will work on official release channels as well.<\/p>\n<h2><a href=\"http:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-inline-stacks.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-340\" src=\"http:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-inline-stacks.png\" alt=\"Inline call stack frames are marked as &quot;inl&quot;.\" width=\"2252\" height=\"898\" srcset=\"https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-inline-stacks.png 2252w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-inline-stacks-300x120.png 300w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-inline-stacks-600x239.png 600w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-inline-stacks-768x306.png 768w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-inline-stacks-1536x612.png 1536w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-inline-stacks-2048x817.png 2048w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-inline-stacks-1000x399.png 1000w\" sizes=\"(max-width: 2252px) 100vw, 2252px\" \/><\/a>One click profiling in about:processes page<\/h2>\n<p>In the about:processes page, it\u2019s possible to see all the Firefox processes and their information. In addition to that, now it\u2019s possible to profile directly through this page with only one click. When you hover over a process, a profile button will appear at the right side of the process name. All you have to do is to click on this button and it will start profiling this specific process for 5 seconds. Once it\u2019s finished, it will open the profiler analysis UI.<\/p>\n<h2><a href=\"http:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-one-click-profiling.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-341\" src=\"http:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-one-click-profiling.png\" alt=\"A profile button will appear on the right side of the process name when they are hovered.\" width=\"1796\" height=\"664\" srcset=\"https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-one-click-profiling.png 1796w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-one-click-profiling-300x111.png 300w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-one-click-profiling-600x222.png 600w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-one-click-profiling-768x284.png 768w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-one-click-profiling-1536x568.png 1536w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-one-click-profiling-1000x370.png 1000w\" sizes=\"(max-width: 1796px) 100vw, 1796px\" \/><\/a>Read profile buffer once to output all samples and markers<\/h2>\n<p>This was one of the performance improvements that we\u2019ve worked on the back-end this quarter. Previously, we were reading the buffer twice for every thread (one for samples and one for markers). Now we are only doing this once and outputting all the threads. This improvement brings ~5x speed up during the profile serialization!<\/p>\n<h2>Localize the presets of Profiler capturing UI<\/h2>\n<p>We are done with localizing our profile analysis UI and we were also done with most of our profile capturing UI. Presets belong to the capturing UI for setting the relevant settings quickly. We\u2019ve now finished the localization work for them as well and we are completely done with the profile capturing UI as well!<\/p>\n<h2><a href=\"http:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-localized-presets.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-342\" src=\"http:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-localized-presets.png\" alt=\"Image shows that the profiler capturing UI is now fully localized.\" width=\"353\" height=\"341\" srcset=\"https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-localized-presets.png 353w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-localized-presets-300x290.png 300w\" sizes=\"(max-width: 353px) 100vw, 353px\" \/><\/a>Better front-end for experience for profiles with many threads<\/h2>\n<p>With Fission, we have more and more processes and threads in Firefox. Because of this, when a user profiles Firefox, they see a lot of threads as well. It\u2019s both hard to navigate with lots of threads and it\u2019s slower to load and use. To fix these issues we worked on various things:<\/p>\n<h3>UI improvements related to track finding<\/h3>\n<h4>Add a search filter to the track context menu<\/h4>\n<p>It\u2019s hard to find the thread you are looking for when there are a lot of threads. To make this easier, we added a search filter in the main tracks context menu. This way, you can search and find the thread you are looking for easily.<\/p>\n<h4>Make it easier to use with a keyboard<\/h4>\n<p>Previously, our context menu wasn\u2019t really keyboard friendly. It was resetting the selected state every time the user pressed enter. That was really annoying because it was making it hard to repetitively show or hide some threads. This task was a bit harder than expected because we were using a third party library for the context menu and it wasn\u2019t maintained anymore for some time. That\u2019s why we forked that library and fixed the issues ourselves.<\/p>\n<h4>Move the location of the main track context menu to the left side of the timeline.<\/h4>\n<p>Our tracks menu button was on the right side of the graph type radio buttons. That wasn\u2019t really\u00a0 visible and our users actually expected it to be on the top of the tracks. So, we moved the track menu button to the left side where the tracks are.<\/p>\n<h4>Add \u201cShow all tracks below\u201d button after filtering<\/h4>\n<p>When you filter some search queries, now \u201cShow all tracks below\u201d will appear and you can make all the search filtered tracks visible by clicking it.<\/p>\n<p>Here\u2019s you can see the things we changed related to tracks menu:<\/p>\n<h3><a href=\"http:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-menu-improvements.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-343\" src=\"http:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-menu-improvements.png\" alt=\"An image that shows the changes in the tracks context menu.\" width=\"1204\" height=\"512\" srcset=\"https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-menu-improvements.png 1204w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-menu-improvements-300x128.png 300w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-menu-improvements-600x255.png 600w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-menu-improvements-768x327.png 768w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-menu-improvements-1000x425.png 1000w\" sizes=\"(max-width: 1204px) 100vw, 1204px\" \/><\/a>Default visible thread list computation changes.<\/h3>\n<p>We\u2019ve changed how we compute the default visible threads when a profile first loads. Previously, it was possible to see a lot of threads in a big profile. Now we\u2019ve limited the visible threads to 15 and we started to get the most active threads among them.<\/p>\n<h3>Performance improvements<\/h3>\n<p>Besides UX changes, it\u2019s also important to make sure that we can show many threads without becoming too slow. We\u2019ve worked on some performance improvements to guarantee that Firefox Profiler still works without a problem with many threads like removing costly getBoundingClientRect calls from canvases. There are still more improvements to be done in the timeline to improve the performance and we are still working on it.<\/p>\n<h2>Profiling for all the threads<\/h2>\n<p>Sometimes it may be possible that you don\u2019t know which thread to profile or you are uncertain about it. In cases like that, it might be a good idea to profile all the threads. In the about:profiling page we have various features now that you can enable. Currently there are 3 options:<\/p>\n<ol>\n<li aria-level=\"1\">CPU Utilization &#8211; All Threads: For profiling CPU utilization values of all the threads<\/li>\n<li aria-level=\"1\">Periodic Sampling &#8211; All Threads: For sampling all the threads. Beware that it will increase the overhead significantly!<\/li>\n<li aria-level=\"1\">Markers &#8211; All Threads: For collecting markers from all the threads.<\/li>\n<\/ol>\n<p>You can also combine these features to profile multiple of these values. But it\u2019s good to keep in mind that all of them will increase the overhead of profiling and you should use it at your own discretion.<\/p>\n<h2>Periodically discovering unregistered threads<\/h2>\n<p>This is also another new feature we have in the about:profiling page. It will periodically discover all the unregistered threads and record their CPU utilization for them. For now, they show up as markers in the main thread, but they will eventually have better UI. Also it increases the overhead of profiling a lot, especially on Windows. So, be careful while using it.<\/p>\n<h2>Other improvements<\/h2>\n<ul>\n<li>Output extra counters before each change, for more accurate graphs.\n<ul>\n<li>This is one of the correctness improvements that we\u2019ve worked on.<br \/>\nBefore (Notice the long orange slope, giving the wrong impression that memory usage is gradually increasing):<br \/>\n<a href=\"http:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-counters-before.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-344\" src=\"http:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-counters-before.png\" alt=\"\" width=\"346\" height=\"133\" srcset=\"https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-counters-before.png 346w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-counters-before-300x115.png 300w\" sizes=\"(max-width: 346px) 100vw, 346px\" \/><\/a>After (Notice the long horizontal orange line before the sudden jump):<br \/>\n<a href=\"http:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-counters-after.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-345\" src=\"http:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-counters-after.png\" alt=\"\" width=\"294\" height=\"132\" \/><\/a><\/li>\n<\/ul>\n<\/li>\n<li>Show &#8220;Edit Settings&#8230;&#8221; button for non-custom presets as well in the profile capturing UI.\n<ul>\n<li>Previously we were only showing this &#8220;Edit Settings&#8230;&#8221; button when the custom preset is selected. That was annoying because if a user had to change the settings, first they had to select the custom preset. Now they don\u2019t have to do that since we display this button all the time.<br \/>\n<a href=\"http:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-edit-settings.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-346 size-medium\" src=\"http:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-edit-settings-300x249.png\" alt=\"\" width=\"300\" height=\"249\" srcset=\"https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-edit-settings-300x249.png 300w, https:\/\/blog.mozilla.org\/performance\/files\/2022\/02\/firefox-profiler-edit-settings.png 512w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/li>\n<\/ul>\n<\/li>\n<li>Fixed the tooltip positioning in the Marker Chart.\n<ul>\n<li>Previously, it was showing the marker tooltips in wrong places or it was jumping around too much. Now it\u2019s fixed and it should show up more seamlessly.<\/li>\n<\/ul>\n<\/li>\n<li>Remove the old profiler related Rust code and start to use our new API.\n<ul>\n<li>We\u2019ve added our Rust API right before the Q3. In Q4, we\u2019ve worked on removing the preexisting profiler related codes from various Rust projects and replaced them with our new API. That way, we removed a lot of code duplication and we started to use our canonical Rust API.<\/li>\n<\/ul>\n<\/li>\n<li>Buffer size units for startup profiling\n<ul>\n<li>We are using some <a href=\"https:\/\/profiler.firefox.com\/docs\/#\/.\/guide-startup-shutdown\">environment variables to capture a startup profile<\/a>. With this change <code>MOZ_PROFILER_STARTUP_ENTRIES<\/code> now accepts various buffer sizes like 512MiB. This was implemented by our contributor, Neel Chauhan, thank you!<\/li>\n<\/ul>\n<\/li>\n<li>Easier profiling browser mochitest failures.\n<ul>\n<li>Now it\u2019s as easy as running <code>.\/mach try fuzzy &lt;path to folder with bc tests&gt; --env MOZ_PROFILER_STARTUP=1<\/code> to get profiles of browser chrome mochitest failures. You will be able to see the output profiles in the artifacts.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>Contributors in Q4 2021<\/h2>\n<p>Lots of awesome people contributed to our codebases both on GitHub and mozilla-central in. We are thankful to all of them! Here\u2019s a list of people who contributed to Firefox Profiler code:<\/p>\n<ul>\n<li aria-level=\"1\">Florian Qu\u00e8ze (<a href=\"https:\/\/github.com\/fqueze\">fqueze<\/a>)<\/li>\n<li aria-level=\"1\">Gerald Squelart (<a href=\"https:\/\/github.com\/squelart\">squelart<\/a>)<\/li>\n<li aria-level=\"1\">Julien Wajsberg (<a href=\"https:\/\/github.com\/julienw\">julienw<\/a>)<\/li>\n<li aria-level=\"1\">Mark Hansen (<a href=\"https:\/\/github.com\/mhansen\">mhansen<\/a>)<\/li>\n<li aria-level=\"1\">Markus Stange (<a href=\"https:\/\/github.com\/mstange\">mstange<\/a>)<\/li>\n<li aria-level=\"1\">Neel Chauhan (<a href=\"https:\/\/github.com\/neelchauhan\">neelchauhan<\/a>)<\/li>\n<li aria-level=\"1\">Naz\u0131m Can Alt\u0131nova (<a href=\"https:\/\/github.com\/canova\/\">canova<\/a>)<\/li>\n<li aria-level=\"1\">Paul Adenot (<a href=\"https:\/\/github.com\/padenot\">padenot<\/a>)<\/li>\n<li aria-level=\"1\">Steve (<a href=\"https:\/\/github.com\/steveadams\">steveadams<\/a>)<\/li>\n<li aria-level=\"1\">Steve Fink (<a href=\"https:\/\/github.com\/hotsphink\">hotsphink<\/a>)<\/li>\n<\/ul>\n<p>Thanks a lot!<\/p>\n<h2>Conclusion<\/h2>\n<p>Thanks for reading! If you have any questions or feedback, please feel free to reach out to me on Matrix (<a href=\"https:\/\/matrix.to\/#\/@canova:mozilla.org\">@canova:mozilla.org<\/a>). You can also reach out to our team on Firefox Profiler channel on Matrix (<a href=\"https:\/\/matrix.to\/#\/#profiler:mozilla.org\">#profiler:mozilla.org<\/a>).<\/p>\n<p>If you profiled something and are puzzled with the profile you captured, we also have the Joy of Profiling (<a href=\"https:\/\/matrix.to\/#\/#joy-of-profiling:mozilla.org\">#joy-of-profiling:mozilla.org<\/a>) channel where people share their profiles and get help from the people who are more familiar with the Firefox Profiler. In addition to that, we have the Joy of Profiling Open Sessions where some Firefox Profiler and Performance engineers gather together on a Zoom call to answer questions or analyze the profiles you captured. It\u2019s usually happening every Monday, and you can follow the<a href=\"https:\/\/calendar.google.com\/calendar\/embed?src=c_cbjhkf8gu6anajlklhuo04hpko%40group.calendar.google.com\"> \u201cPerformance Office Hours\u201d calendar<\/a> to learn more about it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As the Perf-Tools team, we are responsible for the Firefox Profiler. This newsletter gives an overview of the new features and improvements we\u2019ve done in Q4 2021. You can find &hellip; <a class=\"go\" href=\"https:\/\/blog.mozilla.org\/performance\/2022\/02\/15\/performance-tools-newsletter-q4-2021\/\">Read more<\/a><\/p>\n","protected":false},"author":1859,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[779,457016],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/posts\/338"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/users\/1859"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/comments?post=338"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/posts\/338\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/media?parent=338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/categories?post=338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/tags?post=338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}