Headless chrome eats up a surprisingly high amount of CPU. I am using Chrome headless javscript evaluation.
In my use case I'm just trying to get the HTML source of a page after javascript has been evaluated. This allows me to ignore a lot of things that might be CPU heavy.
I have already implemented DevTools interceptors to avoid loading CSS, Images, Videos, and more.
Here are my command line options to chromium:
"--enable-logging",
"--v=1",
"--no-sandbox",
"--disable-bundled-ppapi-flash",
"--mute-audio",
"--hide-scrollbars"
It's still pretty gosh darn CPU heavy, however.
I have a couple ideas how to optimize headless further.
- Per website, detect javascript imports that are CPU heavy but provide nothing to javascript output.
This can help a lot, but it's specific to each site so not that great.
- Make modification to chromium rendering and javascript engine such that it will skip anything that is inapplicable in a headless javascript evaluation scenario.
Has anyone got any other ideas or pointers how I can go about this last bullet?