Closed Bug 1660602 Opened 4 years ago Closed 3 years ago

Profile janky rendering of print preview documents

Categories

(Core :: Printing: Setup, task, P2)

task

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: jwatt, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: perf, Whiteboard: [print2020][old-ui+])

I've noticed that if you load the HTML5 single page spec, then open the new print UI, it seems much slower to scroll the print preview document than it is to scroll the original. Obviously we're creating a bunch more nsIFrames etc. for the print preview document, but we should profile to figure out if there are any easy performance fixes that we may be missing.

Needinfo'ing some people that may be interested/able to take a look.

Flags: needinfo?(mats)
Flags: needinfo?(hikezoe.birchill)
Flags: needinfo?(dholbert)

I'm surprised if layout itself was the reasoning for the slow scrolling, as we basically don't do any incremental layout work for print documents other than centering the pages.

I suspect this is going to be more about stuff like retained display lists being disabled for print / print preview. But I'm happy to be proven wrong! :)

Though I haven't looked yet, if the scrolling is slow there, it means APZ is disabled there?

Looks like APZ is enabled there. That said, I wonder whether scrolling in the old print preview is slow or not, if it's also slow, it doesn't sound urgent (given that print2020_v81 is in the whiteboard).

Scrolling speed is also slow in the old print preview on my Linux box.

Whiteboard: [print2020_v81] → [print2020_v81][old-ui+]

(In reply to Emilio Cobos Álvarez (:emilio) from comment #1)

I suspect this is going to be more about stuff like retained display lists being disabled for print / print preview. But I'm happy to be proven wrong! :)

Very true. :-)

Summary: Profile layout of print preview documents → Profile janky rendering of print preview documents

(In reply to Hiroyuki Ikezoe (:hiro) from comment #3)

Looks like APZ is enabled there. That said, I wonder whether scrolling in the old print preview is slow or not, if it's also slow, it doesn't sound urgent (given that print2020_v81 is in the whiteboard).

Based on our telemetry, currently only 7% of prints go through print preview so only a small percentage of our users will experience the janky rendering during scrolling. If we're making 100% of our users go through print preview then we're dramatically increasing the number of users that may encounter this issue. I think that means this is significantly more important for the new UI than the old.

Whiteboard: [print2020_v81][old-ui+] → [print2020_v82][old-ui+]
See Also: → 1662135
See Also: → 1663753
Whiteboard: [print2020_v82][old-ui+] → [print2020_v83][old-ui+]

FWIW, here is a profile got on https://html.spec.whatwg.org/.

https://share.firefox.dev/304hqBt

I guess in the print preview window, the default display port area is too small?
CCing APZ people.

Flags: needinfo?(hikezoe.birchill)

That profile looks mostly reasonable, except for the high number of draw calls: https://share.firefox.dev/32WK5u1
(For good performance, draw calls should be < 100.)
The profile also shows that WebRender's picture caching is not effective in the Print Preview scroll frame.

Another reason for the worse performance overall is the fact that so many more display items are visible at the same time. For a fairer comparison, you should compare to the regular page at a small zoom factor.

https://share.firefox.dev/3mRB9Os this is a profile for the regular document of https://html.spec.whatwg.org/ which is mostly equivalent scale of what the document looks like in the print preview. (I did use full zoom on 67%) The numbers of NumDrawCalls are actually less than 100.

FWIW, here is a profile on nonWebRender. https://share.firefox.dev/308eq73

At first glace, it looks more busy than the WebRender one, but I kind of feel scrolling is much smoother than the WebRender case, FWIW.

Whiteboard: [print2020_v83][old-ui+] → [print2020_v84][old-ui+]
Whiteboard: [print2020_v84][old-ui+] → [print2020_v85][old-ui+]
Whiteboard: [print2020_v85][old-ui+] → [print2020_v87][old-ui+]
Whiteboard: [print2020_v87][old-ui+] → [print2020][old-ui+]

Hey Jonathan,
Could you please have a fast check on this issue on any of the latest Firefox versions? For me, scrolling is really smooth and fast for the https://html.spec.whatwg.org/ site opened in print preview (newUI).

Flags: needinfo?(jwatt)

My results match Timea -- after the print preview has finished rendering (which does take a little while), scrolling feels pretty snappy for me. I'm using Firefox Nightly 91.0a1 (2021-06-22) (64-bit) on Linux.

Flags: needinfo?(dholbert)

Thank you for the update! Will mark FX91 affected in this case.

I think you meant 91 is not affected, since scrolling is snappy there. :) (i.e. no bug)

And we can call this worksforme, probably, since we have two folks (comment 11 and comment 12) indicating that it's no longer reproducible. Jonathan, please reopen if you disagree.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME

Looks good to me too. Thanks.

Flags: needinfo?(jwatt)
Flags: needinfo?(MatsPalmgren_bugz)
You need to log in before you can comment on or make changes to this bug.