Menu

One clip-path doubled my browser cat's CPU cost in Chrome's GPU process
πŸ“°

One clip-path doubled my browser cat's CPU cost in Chrome's GPU process

DEV Community: webdevΒ·Dmitrii KorotkinΒ·about 13 hours ago
#k3mWvX9W
#devtowebdev#devto#dev#process#chrome
Long article (912 words) β€” no AI summary yet.
Reading 0:00
15s threshold

I made Tabloaf , a pixel cat for Chrome and Firefox. It walks across whatever page you have open, sits on pictures and headings, and chases a ball of yarn.

TL;DR: while the cat walks, Chrome's GPU process went from 15–17% of a core to ~7%, and Firefox's page process from 19–20% to ~2%.

Chrome renders the page in a renderer process and composites layers in a separate GPU process. In Firefox the page (content) process is roughly the renderer. Every percentage here is CPU time as a share of one core, not GPU load.

The default cat is 60Γ—48 CSS pixels. A rectangular hit box would also catch clicks in the empty space around its ears and tail, so I clipped the clickable area to the cat's outline with clip-path .

I put that clip on the canvas that was already moving.

Moving the walk off the frame loop

An earlier version saved CPU by stepping the walk one art pixel at a time, but it looked jerky.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.