Open Bug 1878133 Opened 2 years ago Updated 2 months ago

PDF takes excessively long to render

Categories

(Core :: Graphics: Canvas2D, defect)

Firefox 122
defect

Tracking

()

Performance Impact low
Tracking Status
firefox-esr115 --- affected
firefox122 --- affected
firefox123 --- affected
firefox124 --- affected

People

(Reporter: liamre, Unassigned, NeedInfo)

Details

(Keywords: perf:pageload, reproducible, Whiteboard: [pdfjs-performance])

Attachments

(1 file)

Attached file PDF bug Firefox.pdf

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/20100101 Firefox/122.0

Steps to reproduce:

View the attached PDF.

Actual results:

The PDF took 20+ seconds to render.

Expected results:

The PDF should have rendered quickly (compare to Edge).

Component: Untriaged → PDF Viewer

I'm reproducing the issue on latest Nightly 124.0a1 with Win 11 and macOS 13 as well. It seems that the issue occurs in Firefox for a long time, I am able to see the render delay on older Nightly builds (e.g. 67.0a1, 2019-02-02).

Thanks for reporting this, Liam! Maybe a developer will pick and consider fixing it.

Changing this bug to "NEW".

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Unspecified → All
Hardware: Unspecified → All
Performance Impact: --- → ?
Whiteboard: [pdfjs-performance]

We seem to be keeping the GPU pretty busy with the drawing the DVA logo: https://share.firefox.dev/3x57nzK

I'm not entirely sure if this should be fixed in the viewer or Canvas. Lee might have an idea.

Flags: needinfo?(lsalzman)

The Performance Impact Calculator has determined this bug's performance impact to be low. If you'd like to request re-triage, you can reset the Performance Impact flag to "?" or needinfo the triage sheriff.

Platforms: Windows
Page load impact: Some
Websites affected: Rare
[x] Able to reproduce locally

Performance Impact: ? → low

It seems like PDF.js is doing a lot of unfortunate creation of DrawTargets and mixing accelerated and unaccelerated targets, causing substantial amounts of readbacks. This might be one of those cases where the hypothetical proposal to just not enable acceleration by default in PDF.js will will work better.

Depends on: 1902012
Flags: needinfo?(lsalzman)

Marco, is this related to bug 1874013? The profile from Bas shows a lot of canvas creation going on, which I am seeing also in the AC2D profiles as well outside of Windows... but on Windows, we are using Direct2D acceleration instead, still showing the same pattern of problematic performance. This might hint that there are certain patterns within the PDF.js code that could be aggravating this?

Flags: needinfo?(mcastelluccio)
Flags: needinfo?(mcastelluccio) → needinfo?(cdenizet)
Component: PDF Viewer → Graphics: Canvas2D
Product: Firefox → Core
Summary: PDF takes excessively long to render → PDF takes excessively long to render with hardware acceleration enabled

Is this still reproducible?

Flags: needinfo?(liamre)

Yes, I can still reproduce in Firefox Nightly 140.0a1 (2025-05-19) on macOS 14.7

Flags: needinfo?(liamre)

This means it isn't related to hardware acceleration, since it is disabled for pdf.js.

Summary: PDF takes excessively long to render with hardware acceleration enabled → PDF takes excessively long to render
No longer blocks: 2006057
No longer depends on: 1902012
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: