27
Feb 12

Snappy, Feb 23rd

SUMO Problem investigation

There was an increase in negative feedback regarding Firefox 11 beta relative to Firefox 10 beta on SUMO.  Cheng and me will be analyzing SUMO reports to see if we can find a concrete regression or two in Firefox 11.

(One of the reasons this update is late is because I was digging through our telemetry data looking for something to correlate with user reports)

Cycle Collector + GC

Olli and Jan cooked up (as part of MemShrink?) about:ccdump addon for assist with finding leaks (bug 726346, bug 728669). See Jan’s blog post for more details.

Andrew is working on:

  • reducing how often cycle collector runs in worst-case scenarios, bug 710496
  • A fix that might increase the time between cyclecollector runs 10x, bug 728460, 728547
  • Triggering GC from CC less often, bug 727965

Bill landed incremental GC this week, bug 719492. Most users will not benefit from incremental GC until Bill finishes up handling frequent “corner cases” that end up disabling incremental GC.

DOM

Kyle is adding infrastructure to allow webpages to wait on local storage without blocking user interactions, see 729769.

Profiling

Vlad’s non-destructive chromehang got mostly r+ed, bug 712109.

Frontend

Livemarks will soon be async, bug 613588. What are livemarks? An example of a livemark is the bbc livefeed/folder that we used ship on the bookmarks toolbar. Turned out when we rewrote the UI to hide the bookmarks toolbar, the livemark was still alive and well, hogging the UI while doing disk IO. We took out the default livemark a few releases back, now the code is being converted so users with preexisting bbc livemark (or their own livemarks) don’t suffer accompanying browser lag.

Scrolling

Avi ported his smoothscroll logic to C++, Jared pushed it to the UX branch, bug 206438. If you are interested in fluid scrolling, give it a try, play with acceleration prefs to help us find optimal values. Once this is done, bug 629507 is next and then we get to tell the rest of the browser to not interrupt scrolling/etc in bug 712478. If any readers are interested in helping desktop browsers catch up to mobile levels of responsiveness, this is area is a good place to contribute to.


22
Feb 12

PSA: DOM Local Storage considered harmful

Recently there have been a number of blog posts on optimizations possible via Local StorageAPI. When Microsoft, Google, Amazon and a number of others aggressively adopt a new feature, people notice.

The optimization is to use Local Storage to reduce network requests and/or payload size. This should result in a more responsive experience for the user… except when it doesn’t.

This strategy can backfire because:

  • Local Storage is a synchronous API
  • Local Storage does IO

Disk IO is particularly problematic because it’s non-deterministic for a multitude of reasons. A simple disk operation can take anywhere from zero milliseconds to a few seconds. Browsers cope with this by preloading the entire Local Storage key/value store into memory on first request. While testing a website the developer is likely to frequently reload the same page multiple times. This means that the relevant disk IO is very likely to be cached in the os file cache.

Now consider the case of a user turning on their computer, firing up the browser and going to an optimized site:

  1. The webpage starts to load
  2. Data is read in from Local Storage
  3. Webpage completely freezes for a few seconds while the browser populates Local Storage key/value store.

This freeze can last anywhere from a few milliseconds on an unburdened computer to dozens of seconds on a computer with stock Windows settings (AntiVirus, Windows Indexing Service, etc). Firefox, Chrome, Safari suffer this fate to various degrees.

Local Storage has the following costs:

  1. It can take a long unresponsive while to read in maximum allowable 5megs of data
  2. This data is then in memory for the lifetime of the webpage session wasting memory. Imagine if every one of your tabs decided to do this.
  3. LS is persistent. My profile has 0.5MB of meebo.com data that will haunt me forever even though meebo is long gone from my history.

What should webdevs do instead?

Cry, rely on browser cache. There are no viable alternative at the moment. IndexedDB is complex, requires user to approve it and isn’t widely implemented. WebSQL is all about bringing SQLite problems we’ve been studying and fixing within Firefox to every single webpage.

My best guess is that we’ll end up with webdevs using convenience libraries built on top of IndexedDB. We will likely add promptless operation to IndexedDB.

We have already made Local Storage hurt less, we have a plan to make it relatively painless, but it will always degrade user experience when compared to something like IndexedDB.

Are there any other convenient APIs with terrible complications?

Of course, see sync XHR.

 


16
Feb 12

Snappy, Feb 16

Canadians and their Profilers

Much like eating bacon, writing profiling tools is a favourite Canadian pastime. Unfortunately, while today’s meeting had more Canadians than last time, a few the usual suspects are still busy with Android bugs this week and weren’t able to attend.  There are no updates on about:jank or our profiler this week. Next week, Vlad plans to hook up Windows symbolification to the profiler bringing it up to par with Mac64.

UX Tweaks

Jared is almost done with preparation for snappy scrolling. He is wrapping up making scrollbar + arrow keys behave in a consistent manner, bug 710373. The next step is to tweak our scrolling physics, which may lead us to integrate addon scrolling code in bug 206438. Jared also got rid of pointless “connecting…” tab title on refresh, bug 709182.

IO Optimizations

Brian recently worked out a way to neuter prefetch in bug 692255, this week he added Firefox hooks to take advantage of that in bug 727864. Once that is done our startup speed will be up to us – no longer at the mercy of a misbehaving Microsoft heuristic. Brian also discovered a single-character typo (bug 726503) in my code,which apparently resulted in a 15% speed up in our page-loading benchmark, tp5. I’m disturbed that we didn’t notice respective slowdown when we landed this.

Brian is also bravely battling download-manager lag in bug 632556, 727275.

Marco is working on reducing thread contention due to vacuum/pragmas, bug 723611. Marco is also almost done with rewriting our ill-conceived, jank-happy livemarks code in bug  613588.

Content

Vladan landed a DOM storage fix that should significantly reduce the amount of main thread SQL done by content bug 714964. We plan to make dom storage not cause main thread io lag in bug 712009.

More of the content team is jumping into Snappy work next week, expect to see more in this section.


09
Feb 12

Snappy Feb 9: Blame Canada!

The meeting was short this time because all of the participating people in the Toronto office conspired be busy or on vacation today.

Our UX team helped us decide to turn on tabs-on-demand + do tab restore by default, Bug 711193. This change will make interacting with the browser more responsive after startup, help MemShink and not trigger as much captive wifi portal badness.

Frontend people are busy adding telemetry to everything that matters, bug 671038. Some of this has already paid off in terms of us catching a tab animation regression in bug 724349. We plan to switch our awesomebar searching from SQL to an FTS. If you are a text-search/tokenizer expert, perhaps you help us with bug 725821. There is also a lot of activity on making various sync IO things async, see the meeting notes for complete details.

Brian Bondy posted an update documenting his two-week rampage through Firefox startup inefficiencies on Windows. Brian’s blog post contains tips on xperf, Firefox profiler, about:startup – read it.

The networking team is busy nuking the big cache lock, see bug 717761.

Olli has landed most of the cycle collector fixes. Telemetry shows a dramatic reduction in cycle collection times for Firefox 13. He and Andrew investigating the remaining causes of long CC times.

I’ll end this post with a pretty picture demonstrating recent cycle collection improvements.


* y: frequency, x: milliseconds

 


07
Feb 12

Snappy, Feb 2nd – FOSDEM, Help Wanted

We cancelled last week’s snappy meeting due to Perf/Snappy workweek + FOSDEM. See Jared’s post for a summary of the workweek, I’ll mention the rest below.

We figured out a strategy for avoiding blocking DOM Storage IO (use scriptblocker to async preload relevant dom storage. Do async writeback to commit). We have a plan for cancellable SQL queries, bug 722243.

SetTimeouts/30s telemetry landed in bug 715953, I attached result of that in bug 715376. Persistent telemetry was backed out while Nathan investigates problems, bug 707320.

Brian Bondy has been fixing our usage of Windows APIs:

  • bug 722225 - Firefox startup opt on Windows by optimizing D3D10CreateDevice1 (pending review)
  • bug 722315 - Firefox startup opt on Windows by lazy loading CLSID_DragDropHelper (landed)
  • bug 692255 - Find a way to get rid of prefetch files on Windows for faster startup (pending review)

We spent the weekend at FOSDEM. I re-presented my Plumbers talk on why Linux sucks for starting big apps. I also did a Telemetry talk. The audience was great.

Help Wanted

To my great regret, I forgot to mention that Mozilla is hiring in my talks. In particular, I’m looking for more performance hackers. If enjoy spending quality time with stack traces,writing profilers or analyzing performance logs leave a comment or send me an email. Compiler toolchain and/or kernel hacking experience would be a great bonus.


02
Feb 12

At BetaGroup in Brussels

As the outside temperature reached -10C, the DIY heating system at hackerspace.be proved insufficient. On Wednesday the Perf/Snappy workweek was relocated to BetaGroup Coworking Brussels. We’ll be here until FOSDEM.

Betagroup Coworking Brussels is an industrial-strength coworking space with lots of desk space, internet, kitchen, ping-pong and a bunch of heavy metal…