Mozilla Engineer Reveals Magic Behind Firefox 57 Quantum That Makes It So Fast

Mozilla surprised a lot of people with Firefox 57, also known as Quantum. While it is customary for browser makers to hype up speed improvements with each new major update, oftentimes it's tough to tell a difference outside of running some benchmarks. Not so with the new and improved Firefox browser. Mozilla retooled its browser in hopes of making up for lost ground against Chrome, and part of the perceptible speed increase is the result of how Firefox handles scripts from tracking domains.

Firefox

Specifically, Firefox delays loading scripts from tracking domains when possible during the time a webpage is actively loading and rendering content. Mozilla engineer Honza Bambas came up with the idea, which he calls "tailing," noting that it more efficiently utilizes network bandwidth, I/O, and CPU cycles for loading and processing images and scripts running on sites. The end result is that websites load are ready for viewing sooner than they otherwise would be.

"Tracking scripts are not disabled, we only delay their load for few seconds when we can. Requests are kept on hold only while there are site sub-resources still loading and only up to about 6 seconds. The delay is engaged only for scripts added dynamically or as async. Tracking images and XHRs are always delayed, as well as any request made by a tracking script," Bambas explains.

Bambas points out that this approach does not break any HTML specifications, and that well built sites that adhere to proper HTML code will function exactly the same with the delay in place. In other words, Firefox 57 is not breaking anything, at least on sites that are well designed, it is only speeding them up with a clever trick. But what about sites that are poorly coded? Those can be a problem.

"For sites that are either not well built or their rendering is influenced by scripts from tracking domains there can be a visible or even functional regression. Simply said, some sites need to be fixed to be able to adopt this change in scheduling," Bambas explains.

From our experience with Firefox 57 so far, Mozilla seems to be on the right track. There is a noticeable difference in speed, and we have not seen any weirdness on websites while using Firefox. That said, users can disable the delay if they really want to. To do so, type about:config in the URL bar and set network.http.tailing.enabled to false.

Via:  Mozilla
Show comments blog comments powered by Disqus