knuxify / fxtumblr

Make Tumblr embeds on other websites way better. Like TwitFix/fxtwitter, but for Tumblr.
https://tpmblr.com
MIT License
16 stars 2 forks source link

Consider replacing render engine #16

Closed knuxify closed 1 year ago

knuxify commented 1 year ago

Currently, we use Chromium to render the page. Chromium is notably bulky (and so are most web browsers), so it would be nice to reduce the overhead (preferably without having to write our own renderer from scratch).

Some ideas I've had included:

knuxify commented 1 year ago

Switching to Playwright would allow us to try different browsers; I made a port locally, but couldn't get the other browsers to work on my dev system (they don't offer musl builds and symlinking chromium like I do for pyppeteer works, but firefox fails mysteriously and I have yet to investigate it). Nonetheless, with Chromium alone the render time for the example page goes from ~0.6 seconds to ~0.8 seconds, which is a noticeable downgrade. This is on a very beefy PC with a very good internet connection, and there's no telling how it would perform on a production server...

Nonetheless, if the speed improvement on the other browsers makes it worth it, I might consider switching.

knuxify commented 1 year ago

...nevermind, did a quick test in production: Chromium with Playwright takes 1.8 seconds to render, WebKit - 4.8 seconds, and Firefox doesn't have support for screenshots implemented at all. For comparison, pyppeteer on the same server takes 1.8-2.1 seconds.

knuxify commented 1 year ago

Also pyppeteer uses up less memory thanks to it not being a Python wrapper for a Node CLI.