-
-
Notifications
You must be signed in to change notification settings - Fork 745
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
Process pooling / re-using the same Puppeteer instance for multiple screenshots? #284
Comments
It's not really, unless the answer is that "no" this won't be implemented. What I'm looking for is to have a "single" phantomjs across all screenshots and this is not possible at the moment. |
It was requested here though #282 (comment). As @kevva points out, we don't think it would be possible to change the URL while keeping the process alive. |
I've actually just started working on that using It re-uses the same phatomjs |
I don't think it's worth the effort right now. Once headless chrome lands (not sure when it will happen though), we will switch to that one. So then we could take a look at how it could be done in headless chrome. Unless @kevva or @sindresorhus have another opinion on this one. |
Ok, sure. FWIW, after switching from pageres to the code I just pasted, I got a huge performance boost (possibly 10x) in my script: (each migration generates a screenshot from a url) Before:
After:
Notice how the first screenshot is slower (it creates the phantomjs process) and others are much faster because they re-use that process. So I think it's worth considering in the future, for use cases where performance matters. |
Phantom resource pool: https://gist.github.com/88c0d6cfcd410d655d53eaa787f6b317 I might end up open sourcing this, haha 👍 feel free to re-use |
Released this under https://github.com/blockai/phantom-pool |
Is there any way to re-use the same phantomjs instance for multiple screenshots if the list of URLs aren't known in advance?
The text was updated successfully, but these errors were encountered: