Chrome Extension CPU usage reduction

62 views
Skip to first unread message

Matthew Behan-Fossey

unread,
Jan 29, 2020, 10:02:56 PM1/29/20
to Chromium Extensions
Hi Everyone,

I've almost completed building a chrome extension and I've been doing some battle testing (Opening up lots of windows/tabs/ the extensions popup) and seeing how this effects performance. I've noticed that there can be weird spikes in CPU usage by the "Google Chrome Helper (Render)". 

Im wondering how can I optimize my app/extension so that it is as slim as possible and only uses necessary CPU? What should I look out for? How I can test/debug this to discover unnecessary or repeated processes? 

Any advice, know how, or feedback is welcome. 

Cheers

Is Manu

unread,
Jan 30, 2020, 1:01:34 AM1/30/20
to Chromium Extensions
Not easy to help without seeing your code.
Usually you have to push your action in an array and delayed each actions one After one with a "sleep" timer on each.
Usually i set 50ms between each process but that depend of your blocking code. May have to increase the rest Time.

wOxxOm

unread,
Jan 30, 2020, 9:47:38 AM1/30/20
to Chromium Extensions
This is quite a broad topic but there are two key points - learning how to measure the performance (using devtools profiler or instrumenting the code explicitly) and identify the bottlenecks - this is crucial, otherwise you'll be chasing random guesses most of which will be irrelevant so you'll get frustrated. Sometimes though you may be hitting a bug in the browser so try testing in a much older portable version and in a newer Chrome Canary as well as try a different platform/OS. Look for tutorials on how to properly analyze and optimize performance of code - you can use any web-oriented tutorial like those on devtools site as the optimization isn't something unique to extensions.
Reply all
Reply to author
Forward
0 new messages