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

Use Workers as When rendering a large pdf file it is taking a quite a lot of time #18647

Closed
kotasudhakar opened this issue Aug 24, 2024 · 3 comments

Comments

@kotasudhakar
Copy link

Is the feature relevant to the Firefox PDF Viewer?

No

Feature description

I think using multiple workers(worker threads in node or webworkers in browser) to render canvases using offscreen canvas (https://web.dev/articles/offscreen-canvas#use_with_popular_libraries) (https://web.dev/articles/offscreen-canvas) actually increases the speed exponentially as rendering/drawing these canvas actually taking a lot time

Other PDF viewers

No response

@Snuffleupagus
Copy link
Collaborator

Using multiple web-workers isn't free, since there's overhead when starting them and also overhead when sending data to/from workers; hence there might not be much of a performance improvement overall. Furthermore, using multiple web-workers would significantly increase the complexity of the code and might also introduce various edge-case problems.

Given the overall lack of context, or any actual data that suggests a clear improvement, let's close this as WONTFIX; please also see https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#idea

@Snuffleupagus Snuffleupagus closed this as not planned Won't fix, can't repro, duplicate, stale Aug 24, 2024
@kotasudhakar
Copy link
Author

kotasudhakar commented Aug 24, 2024

Can I actually make a demo and demonstrate the performance improvements, if that's okay @Snuffleupagus ?

@Snuffleupagus
Copy link
Collaborator

Can I actually make a demo and demonstrate the performance improvements,

Please note that #18647 (comment) mentions a number of potential issues, hence a standalone demo probably isn't very helpful. (And once again: please refrain from needlessly tagging users, since that creates notification spam.)

Also, since this is just a word for word copy of k-yle/pdf-to-img#238 it seems that maybe your issue is actually with Node.js since it doesn't support web-workers. (We won't add support for the Node.js "Worker threads" concept in the PDF.js library.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants