Making Firefox Feel Faster
I recently finished work on a sprint to improve perceived performance in Firefox. Unlike code improvements that actually make the browser faster, perceived performance improvements make the browser feel faster. There is currently a long list of brainstormed ideas for these improvements, but Alex Faaborg identified improving mouse wheel behavior in Windows as a quick way to make the browser appear noticeably more responsive. In native Windows applications, scroll events triggered by long flicks of the mouse wheel are not distinguished from events triggered by single wheel clicks, which can result in frustratingly slow scrolling when traveling a long distance down a page. Mac OS X, on the other hand, applies an acceleration effect to mouse wheel events, increasing the distance the page moves in response to multiple successive mouse wheel events. In order to create this acceleration effect in Windows, I wrote some code that changes the way we process mouse wheel events. This code uses some logic and arithmetic to increase the distance the page should move if there are multiple successive mouse wheel events, using the values of three different preferences to determine exact behavior.
- mousewheel.withnokey.numlines: The number of lines the page moves with one click of the mouse wheel. This value is used to determine scrolling distance before acceleration computations are applied. Increasing this value will make scrolling feel faster for all types of scroll wheel actions, including individual scroll wheel clicks.
- mousewheel.acceleration.start: The mouse wheel click number at which acceleration begins to take effect. This value determines whether or not acceleration computations are applied to a given scroll event.
- mousewheel.acceleration.factor: The multiplicative factor used to determine the rate of acceleration. The acceleration computations create a constant acceleration effect, but this value can control the level of acceleration.
These preferences can be configured from the about:config page, and although the default values are not set in stone, they seem to create a reasonable acceleration effect. Feel free to play with these preferences on a nightly build and let me know what you think!