CSS vs. JS Animation: Which is Faster?
davidwalsh.name
davidwalsh.name
Running the animation in the compositor means:
1. You avoid a style recalc on every frame (which can be a big deal).
2. The animation keeps running even if the WebProcess gets contended (by painting new content, handling slow JavaScript, GC).
It's fine to mess with transform and opacity from JavaScript, and for gesture handling you have to, so it needs to be fast, but it has more overhead than a CSS Animation would have.
http://css-tricks.com/myth-busting-css-animations-vs-javascr...
https://github.com/julianshapiro/velocity/issues/6
also, plz contribute to the discussion there if you feel inclined.
less is more when it comes to the web. it really is.
head explodes
For regular comparable x & y:
not (x > y) and not (y > x) --> x = y
So "neither is faster" means "they are equally fast", not "each one is slower than the other". const x = parseInt("CSS");
const y = parseInt("JS");
if ( (!(x > y) && !(y > x)) != (x == y) )
console.log('Sometimes "neither is faster" is not the same as "equally fast"');