background preloader

Performance

Facebook Twitter

Myth Busting: CSS Animations vs. JavaScript. The following is a guest post by Jack Doyle, author of the GreenSock Animation Platform (GSAP).

Myth Busting: CSS Animations vs. JavaScript

Jack does a lot of work with animations in the browser and has discovered that the generic opinion that "CSS is faster" just isn't true. It's more than that, as well. I'll let him explain. Once upon a time, most developers used jQuery to animate things in the browser. Fade this, expand that; simple stuff. The most widely-acclaimed solution was CSS Animations (and Transitions). As someone who's fascinated (bordering on obsessed, actually) with animation and performance, I eagerly jumped on the CSS bandwagon. This article is meant to raise awareness about some of the more significant shortcomings of CSS-based animation so that you can avoid the headaches I encountered, and make a more informed decision about when to use JS and when to use CSS for animation.

Lack of independent scale/rotation/position control Animating the scale, rotation, and position of an element is incredibly common. Workflow. Bitwise Operators - JavaScript. Summary Bitwise operators treat their operands as a sequence of 32 bits (zeros and ones), rather than as decimal, hexadecimal, or octal numbers.

Bitwise Operators - JavaScript

For example, the decimal number nine has a binary representation of 1001. Bitwise operators perform their operations on such binary representations, but they return standard JavaScript numerical values. The following table summarizes JavaScript's bitwise operators: Signed 32-bit integers The operands of all bitwise operators are converted to signed 32-bit integers in big-endian order and in two's complement format.

The following encodes ~314, i.e. the one's complement of 314: Finally, the following encodes -314, i.e. the two's complement of 314: The two's complement guarantees that the left-most bit is 0 when the number is positive and 1 when the number is negative. Best Practices for Speeding Up Your Web Site. The Exceptional Performance team has identified a number of best practices for making web pages fast.

Best Practices for Speeding Up Your Web Site

The list includes 35 best practices divided into 7 categories. Minimize HTTP Requests tag: content 80% of the end-user response time is spent on the front-end. Most of this time is tied up in downloading all the components in the page: images, stylesheets, scripts, Flash, etc. One way to reduce the number of components in the page is to simplify the page's design. Combined files are a way to reduce the number of HTTP requests by combining all scripts into a single script, and similarly combining all CSS into a single stylesheet. Writing Fast, Memory-Efficient JavaScript. Advertisement JavaScript engines such as Google’s V81 (Chrome, Node) are specifically designed for the fast execution2 of large JavaScript applications.

Writing Fast, Memory-Efficient JavaScript

As you develop, if you care about memory usage and performance, you should be aware of some of what’s going on in your user’s browser’s JavaScript engine behind the scenes. You should, however, ask yourself questions such as: Is there anything I could be doing more efficiently in my code? What (common) optimizations do popular JavaScript engines make? Fast-loading Web sites — like fast cars — require the use specialized tools. There are many common pitfalls when it comes to writing memory-efficient and fast code, and in this article we’re going to explore some test-proven approaches for writing code that performs better.

So, How Does JavaScript Work In V8? While it’s possible to develop large-scale applications without a thorough understanding of JavaScript engines, any car owner will tell you they’ve looked under the hood at least once. How to really defer loading javascript. None of the above are solutions to the problem of actually allowing a webpage to fully load and then (and only then) loading external JS.

How to really defer loading javascript

Nor will any of the above always get you past that "Defer loading of javascript" warning you are getting from the Google page speed tool. This solution will and is the recommended solution from the Google help pages. Superhero.js.