Closed Bug 716103 Opened 13 years ago Closed 12 years ago

Scrolling (esp. with mouse wheel) is janky while decoding images (and while the event loop is otherwise busy with short events)

Categories

(Core :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: justin.lebar+bug, Unassigned)

References

Details

(Whiteboard: [snappy])

Attachments

(1 file)

When you go to an image-heavy page (e.g., [1]) and switch away from that tab for ~20s [2], we discard all the decoded images on the page.  When you return to the tab, we kick off decodes for every image on that page.  This keeps the event loop rather busy.  But with bug 715308, we insert only one event into the event loop, and it runs for 10ms before yielding.

And yet even with the patch in bug 715308, scrolling with my mouse's scroll wheel while the images are re-decoding is janky.  Scrolling with the scroll bar is marginally better.

I suspect this has nothing to do with images.  Perhaps a scroll via the mousewheel takes many trips through the event loop in order to complete.  If so, we should try to reduce the number of times that scrolling code yields.

STR:

* Set image.mem.min_discard_timeout_ms to 100.
* Load [1].
* Open a blank tab.
* Switch back to [1], and immediately
* Try to scroll, using the scrollwheel and the scollbar.

[1] http://www.boston.com/bigpicture/2011/12/the_year_in_pictures_part_ii.html
[2] The range is from image.mem.min_discard_timeout_ms to 2x that value.
Whiteboard: [snappy]
Attached file (Non-image) testcase
This testcase demonstrates that the scroll jank occurs even when the page spams timeouts (and scrolling with the mousewheel is worse than scrolling with the scrollbar, at least on my Linux-64 box).

I'm not as concerned about the case when the page spams events as I am about the case where Firefox spams events (say, due to image decoding).  But I'm not sure if we need a general solution or some change to the image decoding code.

My browser is basically unresponsive for 10s after I switch to the big picture page and we start re-decoding all the images.
Summary: Scrolling with mouse wheel is janky while decoding images → Scrolling (esp. with mouse wheel) is janky while decoding images (and while the event loop is otherwise busy with short events)
Note that this kind of jank won't show up on any of our profilers, because we do yield to the event loop often enough.  It appears that our front-end isn't sufficiently aggressive about taking advantage of the events it gets, though.
So, exactly what platforms have you actually validated this against to make it be an all platforms bug.  I have no issue scrolling your testcase under Linux.
Fair enough point about assuming it applies to all platforms, but I've tested on Linux myself.  :)

You scroll smoothly on my attached testcase after you click the button?
Actually, I think this was caused by a completely brain-dead >= instead of <= bug.  With the fix from bug 715308 comment 86, I no longer see this issue!
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: