Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A single page pdf is taking 4 min to render #17779

Closed
calixteman opened this issue Mar 7, 2024 · 3 comments
Closed

A single page pdf is taking 4 min to render #17779

calixteman opened this issue Mar 7, 2024 · 3 comments

Comments

@calixteman
Copy link
Contributor

Attach (recommended) or Link to PDF file here:
p95.pdf

Configuration:

  • Web browser and its version: Firefox nightly
  • Operating system and its version: Windows 11

Steps to reproduce the problem:

  1. Open the pdf
  2. and wait...

It seems that the pdf contains a lot of paths outside the clip box and for each of them we call with a null argument:

this.consumePath(this.current.getClippedPathBoundingBox());

which itself calls at some point:

function genericComposeSMask(

That said, the overall rendering is incorrect: the lines for the borders and some grayed countries are not rendered at all.

@Snuffleupagus
Copy link
Collaborator

Is the underlying issue here perhaps (partially) related to the fact that SMask handling is inefficient, given the use of getImageData/putImageData calls?
This is reminding me of #14982 (comment), which talks about possible alternatives.

@calixteman
Copy link
Contributor Author

Is the underlying issue here perhaps (partially) related to the fact that SMask handling is inefficient, given the use of getImageData/putImageData calls? This is reminding me of #14982 (comment), which talks about possible alternatives.

Yep, it's on my long todo list.

calixteman added a commit to calixteman/pdf.js that referenced this issue Apr 30, 2024
and implement then in using some SVG filters and composition.
Composing in using destination-in in order to multiply RGB components by
the alpha from the mask isn't perfect: it'd be a way better to natively have
alpha masks support, it induces some small rounding errors and consequently
computed RGB are approximatively correct.
In term of performance, it's a real improvement, for example, the pdf in
issue mozilla#17779 is now rendered in few seconds.
There are still some room for improvement, but overall it should be a way
better.
calixteman added a commit to calixteman/pdf.js that referenced this issue Apr 30, 2024
and implement then in using some SVG filters and composition.
Composing in using destination-in in order to multiply RGB components by
the alpha from the mask isn't perfect: it'd be a way better to natively have
alpha masks support, it induces some small rounding errors and consequently
computed RGB are approximatively correct.
In term of performance, it's a real improvement, for example, the pdf in
issue mozilla#17779 is now rendered in few seconds.
There are still some room for improvement, but overall it should be a way
better.
calixteman added a commit to calixteman/pdf.js that referenced this issue May 1, 2024
…(bug 1874013)

and implement then in using some SVG filters and composition.
Composing in using destination-in in order to multiply RGB components by
the alpha from the mask isn't perfect: it'd be a way better to natively have
alpha masks support, it induces some small rounding errors and consequently
computed RGB are approximatively correct.
In term of performance, it's a real improvement, for example, the pdf in
issue mozilla#17779 is now rendered in few seconds.
There are still some room for improvement, but overall it should be a way
better.
@marco-c
Copy link
Contributor

marco-c commented May 1, 2024

Should we close this now that #18029 was merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Closed
Development

No branches or pull requests

3 participants