{"id":234,"date":"2021-08-05T09:34:09","date_gmt":"2021-08-05T16:34:09","guid":{"rendered":"https:\/\/blog.mozilla.org\/performance\/?p=234"},"modified":"2021-08-05T19:20:14","modified_gmt":"2021-08-06T02:20:14","slug":"performance-in-progress","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/performance\/2021\/08\/05\/performance-in-progress\/","title":{"rendered":"Performance in progress"},"content":{"rendered":"<p>In the last six months the Firefox performance team has implemented changes to improve startup, responsiveness, security (Fission), and web standards.<\/p>\n<h2>Startup and perceived startup<\/h2>\n<p>Doug Thayer and Emma Malysz implemented work to improve the perceived startup of Firefox on Windows using a concept called the skeleton UI. Users on Windows may click the Firefox icon and not get visual feedback in the timeline they expect that Firefox is starting. So they click the icon again. And again. And then their screen looks like this.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-235\" src=\"http:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-27-at-4.35.00-PM.png\" alt=\"\" width=\"1067\" height=\"470\" srcset=\"https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-27-at-4.35.00-PM.png 1067w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-27-at-4.35.00-PM-300x132.png 300w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-27-at-4.35.00-PM-600x264.png 600w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-27-at-4.35.00-PM-768x338.png 768w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-27-at-4.35.00-PM-1000x440.png 1000w\" sizes=\"(max-width: 1067px) 100vw, 1067px\" \/><\/p>\n<p>The reason that startup takes a long time is that many things need to happen before Firefox starts.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-236\" src=\"http:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-27-at-4.36.56-PM.png\" alt=\"\" width=\"1031\" height=\"553\" srcset=\"https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-27-at-4.36.56-PM.png 1031w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-27-at-4.36.56-PM-300x161.png 300w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-27-at-4.36.56-PM-600x322.png 600w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-27-at-4.36.56-PM-768x412.png 768w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-27-at-4.36.56-PM-1000x536.png 1000w\" sizes=\"(max-width: 1031px) 100vw, 1031px\" \/><\/p>\n<p>As part of startup, we need to start the JS engine, load the profile to get the size and position of the window. We also need to load a large library called XUL.dll which takes a lot of time to read from disk, especially if your computer is slow.<\/p>\n<p>So what changes did the skeleton UI implement? Basically after the icon is clicked, we immediately show a window to indicate that Firefox is starting.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-237\" src=\"http:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-27-at-4.50.18-PM.png\" alt=\"\" width=\"1050\" height=\"467\" srcset=\"https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-27-at-4.50.18-PM.png 1050w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-27-at-4.50.18-PM-300x133.png 300w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-27-at-4.50.18-PM-600x267.png 600w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-27-at-4.50.18-PM-768x342.png 768w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-27-at-4.50.18-PM-1000x445.png 1000w\" sizes=\"(max-width: 1050px) 100vw, 1050px\" \/><\/p>\n<p>The final version of the skeleton UI looks at the user\u2019s past sessions and creates a window with the theme, window dimensions, toolbar content and positions. You can see what it looks like in this video where the <a href=\"https:\/\/www.youtube.com\/watch?v=HU75b2FP9kU&amp;t=6s\">right hand side<\/a> starts up with the skeleton UI in place. These changes are now available on Firefox 92 beta and riding the trails to release!<\/p>\n<div id=\"attachment_238\" style=\"width: 1290px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-238\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-238 size-full\" src=\"http:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/saffu-E4kKGI4oGaU-unsplash.jpg\" alt=\"\" width=\"1280\" height=\"1600\" srcset=\"https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/saffu-E4kKGI4oGaU-unsplash.jpg 1280w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/saffu-E4kKGI4oGaU-unsplash-300x375.jpg 300w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/saffu-E4kKGI4oGaU-unsplash-600x750.jpg 600w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/saffu-E4kKGI4oGaU-unsplash-768x960.jpg 768w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/saffu-E4kKGI4oGaU-unsplash-1229x1536.jpg 1229w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/saffu-E4kKGI4oGaU-unsplash-1000x1250.jpg 1000w\" sizes=\"(max-width: 1280px) 100vw, 1280px\" \/><p id=\"caption-attachment-238\" class=\"wp-caption-text\">Photo by<a href=\"https:\/\/unsplash.com\/@saffu?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\"> Saffu<\/a> on<a href=\"https:\/\/unsplash.com\/s\/photos\/fast?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\"> Unsplash<\/a><\/p><\/div>\n<p>In other impactful work to address startup, last summer, Keefer Rourke, an intern on the performance team <a href=\"https:\/\/krourke.org\/blog\/200828-coop-s20\">wrote a simplified API<\/a> for file IO called IOUtils for use with privileged JavaScript. Emma Malysz and Barret Rennie, along with contributors <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=986145\">migrated the existing startup code to IOUtils<\/a> to improve startup performance.<\/p>\n<h2>Responsiveness<\/h2>\n<p>Previously, when a Firefox user encountered a page that had a script that ran over a certain timing threshold, you would see a warning message that looked as follows:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-239\" src=\"http:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/pasted-image-0.png\" alt=\"\" width=\"1020\" height=\"170\" srcset=\"https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/pasted-image-0.png 1020w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/pasted-image-0-300x50.png 300w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/pasted-image-0-600x100.png 600w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/pasted-image-0-768x128.png 768w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/pasted-image-0-1000x167.png 1000w\" sizes=\"(max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<p>For many people, this warning showed up too often, the cause was unclear and the options or next steps were confusing.<\/p>\n<p>Doug Thayer and Emma Malysz embarked on work in early 2021 to reduce the proportion of users who experience the slow script warning. The solution that was implemented changed the user experience so the warning would only show if a user interacted with a hung page. They also added code to blame the page that\u2019s causing the hang and remove the confusing \u201cwait button\u201d.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-240\" src=\"http:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/pasted-image-1.png\" alt=\"\" width=\"942\" height=\"113\" srcset=\"https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/pasted-image-1.png 942w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/pasted-image-1-300x36.png 300w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/pasted-image-1-600x72.png 600w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/pasted-image-1-768x92.png 768w\" sizes=\"(max-width: 942px) 100vw, 942px\" \/><\/p>\n<p>The result is a 50% reduction in slow script notification submissions!<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-243\" src=\"http:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/pasted-image-2.png\" alt=\"\" width=\"1294\" height=\"298\" srcset=\"https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/pasted-image-2.png 1294w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/pasted-image-2-300x69.png 300w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/pasted-image-2-600x138.png 600w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/pasted-image-2-768x177.png 768w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/pasted-image-2-1000x230.png 1000w\" sizes=\"(max-width: 1294px) 100vw, 1294px\" \/><\/p>\n<h3>Vsync<\/h3>\n<p>Sean Feng implemented <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1697585\">changes<\/a> to make user interaction more strictly aligned with when the next frame is going to be presented on the screen. This makes Firefox feel more responsive by making sure a Frame always contains the result of all pending user interactions. On mobile Sean also implemented changes for better responsiveness on mobile devices. Sean <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1697585\">landed code<\/a> to allow the coalescing of more <a href=\"https:\/\/www.w3schools.com\/jsref\/event_touchmove.asp\">touchmove<\/a> events to generate the events more efficiently.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-241\" src=\"http:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-29-at-1.10.27-PM.png\" alt=\"\" width=\"1600\" height=\"651\" srcset=\"https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-29-at-1.10.27-PM.png 1600w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-29-at-1.10.27-PM-300x122.png 300w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-29-at-1.10.27-PM-600x244.png 600w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-29-at-1.10.27-PM-768x312.png 768w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-29-at-1.10.27-PM-1536x625.png 1536w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-29-at-1.10.27-PM-1000x407.png 1000w\" sizes=\"(max-width: 1600px) 100vw, 1600px\" \/><\/p>\n<p>The impact of Sean\u2019s work plus <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1708325\">Matt Woodrow\u2019s vsync work <\/a>in bug is reflected in the graph above.\u00a0 To read more about other responsiveness changes in Firefox, <a href=\"https:\/\/blog.mozilla.org\/performance\/2021\/07\/13\/bringing-you-a-snappier-firefox\/\">Bas Schouten\u2019s blog post<\/a> provides more details.<\/p>\n<h2>Security (Fission)<\/h2>\n<p>Fission is site isolation in Firefox. If you want to learn more, read this detailed and thorough <a href=\"https:\/\/blog.mozilla.org\/security\/2021\/05\/18\/introducing-site-isolation-in-firefox\/\">blog post <\/a>by Anny Gakhokidz and Neha Kochar to learn about the implementation and rollout of Fission in Firefox.<\/p>\n<p>Sean Feng and Randell Jesup landed changes to improve process switches related to <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1708488\">NSS initialization<\/a> and <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1710671\">http accept setup<\/a> in process preallocation for Fission. There are improvements on several pages on Windows (~9% for google search, 5% for bing, around 3-4% for gmail, 2-3% for Microsoft); This should cut process-switch times by 6-8ms, perhaps as high as 10. Previously, we were seeing 20-40ms of time attributable to switching processes.<\/p>\n<div id=\"attachment_242\" style=\"width: 1610px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-242\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-242 size-full\" src=\"http:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-20-at-2.53.49-PM.png\" alt=\"\" width=\"1600\" height=\"681\" srcset=\"https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-20-at-2.53.49-PM.png 1600w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-20-at-2.53.49-PM-300x128.png 300w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-20-at-2.53.49-PM-600x255.png 600w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-20-at-2.53.49-PM-768x327.png 768w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-20-at-2.53.49-PM-1536x654.png 1536w, https:\/\/blog.mozilla.org\/performance\/files\/2021\/08\/Screen-Shot-2021-07-20-at-2.53.49-PM-1000x426.png 1000w\" sizes=\"(max-width: 1600px) 100vw, 1600px\" \/><p id=\"caption-attachment-242\" class=\"wp-caption-text\"><a href=\"https:\/\/treeherder.mozilla.org\/perfherder\/graphs?highlightAlerts=1&amp;highlightChangelogData=1&amp;series=mozilla-central,3411940,1,13&amp;timerange=7776000\">View in Perfherder<\/a><\/p><\/div>\n<h2>Web standards<\/h2>\n<p>The Performance Event Timing API was enabled in Firefox 89 by Sean Feng on all platforms. This API provides web page authors with insights into the latency of certain events triggered by user interactions which is a prerequisite for <a href=\"https:\/\/web.dev\/learn-web-vitals\/\">Web Vitals<\/a>. To learn more read <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1667836\">1667836 &#8211; Prototype PerformanceEventTiming<\/a>, the <a href=\"https:\/\/groups.google.com\/g\/mozilla.dev.platform\/c\/eLXz442Icxs\/m\/KKqM5_KuAQAJ\">announcement<\/a> and the <a href=\"https:\/\/wicg.github.io\/event-timing\/#sec-performance-event-timing.\">specification<\/a>.<\/p>\n<h2>Tooling<\/h2>\n<ul>\n<li>Denis Palmeiro added <a href=\"https:\/\/github.com\/sitespeedio\/browsertime\/pull\/1601\/commits\/582fa407b82d37404e04b6fb397e8a9651da137f\">Firefox memory support<\/a> to upstream <a href=\"https:\/\/github.com\/sitespeedio\/browsertime\">browsertime<\/a>. The next steps are to implement some tests in CI so we capture measurements on an ongoing basis.<\/li>\n<li>Andrew Creskey added <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1696945\">Perfstats<\/a> support to allow us to collect low-overhead timings for any component of the runtime.<\/li>\n<li>Denis for landed changes to <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1690373#c6\">Extend Browsertime to collect select PerfStats<\/a> in upstream browsertime.<\/li>\n<\/ul>\n<p>The performance team would like to thank everyone who contributed to this work<\/p>\n<p>Markus Jaritz, Eric Smyth, Adam Gashlin, Molly Howell, Chris Martin, Jim Mathies, Aaron Klotz, Florian Qu\u00e8ze, Gijs Kruitbosch, Mike Conley, Markus Stange, Emma Malysz, Doug Thayer, Denis Palmerio, Sean Feng, Andrew Creskey, Barret Rennie, Benjamin De Kosnik, Bas Schouten Marc Leclair and Mike Comella. A special thanks to Doug Thayer for the artwork to display the changes in the skeleton UI and slow script work!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the last six months the Firefox performance team has implemented changes to improve startup, responsiveness, security (Fission), and web standards. Startup and perceived startup Doug Thayer and Emma Malysz &hellip; <a class=\"go\" href=\"https:\/\/blog.mozilla.org\/performance\/2021\/08\/05\/performance-in-progress\/\">Read more<\/a><\/p>\n","protected":false},"author":1801,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[457019],"tags":[322936,2022,69,248,794,457016],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/posts\/234"}],"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\/1801"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/comments?post=234"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/posts\/234\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/media?parent=234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/categories?post=234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/tags?post=234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}