That pure JS versus "Write less" jQuery; • JavaScript layouting; • GPU vs CPU; • CSS layout, paint and composite layer in animations; • For each ~16ms we have 1 frame and 60 in 1 second;
100 times faster ! window.innerHeight vs. $(window).height() more than 220 times faster ! el.clientWidth vs. $el.width() more than 50 times faster Tested at! http://jsperf.com
! el.clientHeight; el.clientWidth; el.offsetTop; ! We force the browser to re-calculate the layout, so if we do:! ! $el.height(); $el.width(); $el.offset().top; ! We have less performance :(
want to use the GPU on our element in 2D animations cases:! ! ! transform: transale3d(0, 0, 0); ! or ! .accelerated { transform: transale3d(0, 0, 0); }
experimental technology and its compatibility is limited.! It tells what will gone change for the browser be able to do specific optmizations for CSS Properties.! ! .el { will-change: transform; } ! ! Browser support! Chrome 36+! Firefox 36+! Opera 24+! Safari (not supported)! Internet Explorer (not supported)
numbers;! ! • Painting is fast, but still use only the CPU! ! • The composite layers are transfered to the GPU like bitmaps, combined and then drawn on the screen! • The "layer" is an independent subtree of the DOM, composited at the GPU and possible to move, stretch and fade without repainting!