Quantum Flow Engineering Newsletter #15
Last week many Mozilla developers attended the Mozilla All Hands at San Francisco. I didn’t attend the All Hands myself but from the activity on Bugzilla it looks like it was a productive week. 🙂 The intention behind the work week this time was to do focused work leveraging the face to face time that people have together with the goal of improving the 57 release. In the areas that I watch daily these days (mostly Speedometer V2 and [qf:p1] bugs) the focus was really great, and you will see the details in the acknowledgement section at the bottom. I hope that reflects how the week was for everyone who attended!
There were 26 [qf:p1] bugs fixed during the week, and progress were made on many more others. A lot of these are tricky bugs often times requiring changes to old or complex code, so this is an impressive number! There was also some fantastic progress on Speedometer, a lot of improvements landed on the JS engine side, we found a few new issues to work on during measurements, and the work is making progress at a good pace. Profiling Speedometer has been really interesting, there is so much code that runs under the benchmark that we keep finding new issues as we keep looking at various narrow portions of profiles. The graphs below show the progress in the last couple of weeks (note the new test runs on PGO builds on the reference hardware!).
One important performance related project that also landed was budget based background timeout throttling. This is the initial implementation of the heuristic that Chrome shipped for throttling the timeouts running in background tabs based on a budget scheme (which means if a background tab runs too much timers, it will get throttled.) There is still work remaining to be done before we can enable this feature but but it’s great to see it get to this stage. This will be another step we are taking to deal with the issue of background tabs that run too many timeouts.
One final note, next week I will be away on vacation, so once again you can expect the next one of these in two weeks! With that said, now it’s time to acknowledge the help of those of you who contributed to making Firefox faster these past two weeks! I hope I am not forgetting any names by mistake.
- Olli Pettay made it so that we don’t GC on shutdown, which should help with shutdown speed. He also made us avoid dispatching a selectionchange event for pages that do not have such a listener registered. He also made nsContentList stop receiving DOM mutation events when its refcount drops to 0 while it’s waiting for deferred deletion to clean it up. He also made the forgetSkippable phase of the cycle collector more incremental by honoring the slice budget. Additionally he made the IME code in the content process only cache properties at animation tick time in order to avoid flushing layout too eagerly. This was showing up as slowness on Twitter.
- Mats Palmgren improved PresArea free list retention strategy for small arrays to avoid malloc/free churns. He also made media elements use a simpler mutation observer than a heavy-weight Range object. He also removed a synchronous layout flush from the media elements code which was no longer necessary.
- William Chen reordered element and attribute name hashes used in the HTML parser so that the binary search algorithm can be switched to use level order to utilize better CPU cache efficiency. This improves the speed of looking up string names for elements and attributes when parsing HTML.
- André Bargull made us avoid repeated string atomizations when retrieving the unresolved name of a bound function. He also added an opportunistic optimization for avoiding memory allocations during case conversions of inline strings.
- Ryan Hunt landed the initial implementation of asynchronous scrolling using keyboard events. This is currently disabled by default, pending being turned on when the remaining dependencies get resolved.
- Milan Sreckovic relanded Gerald Squelart’s fix for removing the PContent::Msg_GetGfxVars sync IPC after fixing the race conditions in the original patch. He also relanded Gerald’s fix for removing the PContent::Msg_GetGraphicsDeviceInitData sync IPC message.
- Kan-Ru Chen made us attempt to reset the timer only once per osfile.reset_worker_delay.
- Gijs Kruitbosch avoided instantiating the panelview and panelmultiview XBL bindings while opening a browser window.
- Perry Jiang removed the main-thread IO from CrashSubmit.jsm and KeyValueParser.jsm.
- Ray Lin removed synchronous layout flushes from the built-in <video> controls when they’re being constructed.
- Ting-Yu Chou added a cache for properties not present on DOM Xray wrappers in order to speed up looking up non-existent properties on such wrappers. This is part of the ongoing work to improve the speed of accessing web page content from privileged JS code, as commonly done by WebExtensions that need to interact with pages and also similar browser features implemented in JS.
- Michael Layzell got rid of the PContent::Msg_CreateWindow sync IPC message! He also removed the PBrowser::Msg_GetWidgetNativeData sync IPC message. He also enabled collecting native backtraces for Background Hang Reports on Linux on Nightly. He also fixed a recent performance regression caused by sending down permissions to a newly created content process.
- Evelyn Hung made it so that we start speculative connection when autocompleting in the AwesomeBar.
- JW Wang made it so that we can’t block the main thread when acquiring a lock inside VideoFrameContainer::InvalidateWithFlags by getting rid of the mutex entirely.
- Andreas Farre added budget-based background timeout throttling to help smooth our random jank that might occur from background timers running in the browser.
- Alessio Placitelli moved the telemetry session pings to the idle queue after the sleep-wake or idle-active cycles.
- Cervantes Yu made telemetry collect information about the amount of allocated heap asynchronously.
- Bao Quan ported the code responsible for creating XPath expressions for session restore to C++. This helps improve the performance of this code, and reduce the amount of GC pressure caused as a result of the code running.
- Florian Quèze added a test for keeping track of the JS components and modules that get loaded during content process startup to prevent gradual slowdown of startup in the content process by adding unintended dependencies to the critical path. He also converted the remaining Promise.defer() uses in the front-end code to either use PromiseUtils.defer() or new Promise().
- Boris Zbarsky made the JS wrapper object for DOM NodeList objects to be allocated in the incremental collector’s nursuery. This allows these wrapper objects to be collected incrementally in case the web page script doesn’t store a long-living reference to them.
- Milind L. replaced the findNodeByDetails method with a faster map of nodes by details to speed up the lookups.
- Thomas Nguyen moved the Windows UI sound player backend to run on a background thread to avoid janking the main thread. This is the code that plays system sounds in response to user interactions with the browser UI.
- Ben Kelly avoided hashtable lookups to read an almost static preference when Window.setTimeout()/setInterval() is called.
- Samael Wang enabled IPDL timeout for communicating with the GPU process, to enable recovering from cases where the GPU process is too slow to respond to messages.
- Marco Bonardo converted PlacesTransaction to the new asynchronous Bookmarks.jsm API.