Skip to content

Instantly share code, notes, and snippets.

@kirbysayshi
Last active August 29, 2015 14:13
Show Gist options
  • Save kirbysayshi/695fcd0780ca7eb242b8 to your computer and use it in GitHub Desktop.
Save kirbysayshi/695fcd0780ca7eb242b8 to your computer and use it in GitHub Desktop.
Equalizer animation experiments. But why so much CPU and not GPU?

I'm experimenting with the most efficient way (in terms of CPU / battery usage) to make a small equalizer animation that will appear multiple times on a page.

I've tried CSS animations, CSS transitions, canvas drawing, and a plain GIF (and more not listed here!). I'd expect the CSS animations and transitions to be completely GPU powered, but Chrome 39.0.2171.99 on my Macbook Air 10.10 uses large amounts of CPU (shown in both the Chrome Task Manager as well as Activity Monitor). I've set layout boundaries via overflow: hidden, checked paint rects, etc.

Here are the different tests:

Caveats:

  • the GIF is running at ~25 fps, as is the canvas animation via manual setTimeout
  • The GPU process in the chrome task manager does consume time for each of these
  • I tried the typically-non-hardware accelerated properties like scale() and translate(), and the CPU usage was rougly the same!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment