9/14/16

Google and high CPU usage? Let's investigate! (Part 1)

I don't know if anyone has noticed before, but Google (the website, not the browser) has
a very high CPU usage, at least on Firefox! When I open it, it spikes constantly to 30-40%.
Even worse, on my older PC, it easily reaches 90% of usage!
Once and for all I decided to investigate the reason behind this, and...
I discovered something really weird!

My approach was simple: opening the DOM inspector and erasing elements till CPU usage decreased, so I could discover who was the culprit causing this CPU "mess".
I firstly thought it could be a script with a busy loop, it would make sense.
But the culprit was... *suspense sound* a hidden spinning loading icon!



More precisely, the high CPU usage is due to the animation of that spinning icon.
It is entirely made in CSS3, by using the transform property and applying a rotation.
On newer hardware this can be almost unnoticeable, but on older hardware it's really a pain.
Plus it doesn't really have a meaning. I mean, what is the purpose of a hidden spinning icon?
I've even tested on Google Chrome and it handles almost perfectly the CSS3 spinning icon.
In fact, there, the CPU usage is almost normal, the difference is unnoticeable.
On Microsoft Edge, instead, it goes 15-16%. Internet Explorer? Same.
The easier way to return to normal CPU usage is to block the now infamous spinning icon.
It can be easily done with any ad-blocker extension!
For example, on uBlock Origin it suffices to add a personal filter like this:
google.*##g-loading-icon._F9g._y9g
It means: block on Google any "g-loading-icon" element whose class matches "_F9g" and "_y9g".
Unless Google decides to change the name of those classes (or even better to remove definitely the spinning icon), they can be used to identify the spinning icon and to block it.

On Adblock Plus it's a bit more complicated, it doesn't support wildcards for domain extensions.
So the specific extension must be specified entirely depending on the accessed Google domain.
For example:
google.com##g-loading-icon._F9g._y9g
Or:
google.co.uk##g-loading-icon._F9g._y9g
Another simpler way would be to remove completely the domain, but I wouldn't suggest it:
##g-loading-icon._F9g._y9g
Plus the option "allow some non-intrusive advertising" must be disabled otherwise Google will be whitelisted and any custom filter regarding Google will be ignored. At least I couldn't make it work in a different way. If it can work even by keeping it enabled let me know!

That's all for now! I hope this post was of some help to anyone reading it!
If so, let me know below in the comments.

No comments:

Post a Comment