Making changes to Chromium source to optimize headless chrome CPU usage

101 views
Skip to first unread message

Nicholas DiPiazza

unread,
Aug 3, 2018, 8:30:20 PM8/3/18
to Chromium-dev
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? 


Nicholas DiPiazza

unread,
Aug 8, 2018, 2:54:02 PM8/8/18
to Chromium-dev
Anyone have any ideas on this? I'm just looking for some more views hopefully some ideas can be brainstormed.

bruce...@chromium.org

unread,
Aug 9, 2018, 2:02:41 PM8/9/18
to Chromium-dev
Have you profiled to see where the CPU time is going? There are hundreds of possibilities as to what might be causing the excessive CPU consumption. perf on Linux, Instruments on OSX, or ETW on Windows can tell you where time is going so that you can decide what, if anything, can be changed.

Nicholas DiPiazza

unread,
Aug 9, 2018, 2:11:20 PM8/9/18
to bruce...@chromium.org, Chromium-dev
Hey Bruce thanks for the reply. Profiling sounds like it's the way to go.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to a topic in the Google Groups "Chromium-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/a/chromium.org/d/topic/chromium-dev/-5aD4Fd6v5s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/6792df53-13cd-41fe-8f15-bfb505ed7108%40chromium.org.
Reply all
Reply to author
Forward
0 new messages