How to make your websites download and run fast [part one]
December 1, 2011 § 1 Comment
There are few simple rules that can help you create website and web applications that download remarkably fast, some of these rules have to do with JavaScript, CSS, HTML, server configuration and HTTP requests. I use/recommend Page Speed to help analyzing the performance of my web pages. In this post I will talk about rules concerning JavaScript.
- Write efficient code, where every line serves a purpose, avoid unnecessary loops and stuff like that.
- Load only JavaScript files/resource needed for the current page, if possible.
- Defer the parsing of JavaScript(load your code asynchronously), chances are your JavaScript code is not needed during initial page load. read more here.
- Combine your external JavaScript files, this will reduce the number of HTTP requests needed, therefore decreasing page load time. This doesn’t mean you shouldn’t develop your code in a modular way, which is the way that makes more sense most of the time, just combine this file on the server, using a server side script loader. read more here.
- Minify JavaScript, Minification is the process of removing all unnecessary characters from source code, without changing its functionality. There are many free tools to do this, I personally use YUI Compressor.
Let me know if you have other tips that help make code run faster in the browser, by commenting below.
Nice! can’t wait for part two.