Home » JavaScript optimization » Page 3

Use Delta Encoding to Compress RSS newsfeeds – delta compression saves bandwidth

Delta encoding (also called delta compression) is a way to update web pages by sending the “diffs” or deltas between versions of a web page. The server (proxy or origin) sends only what has changed in the page since the last access. This technique greatly reduces the amount of data that is sent from server to browser. In some cases with pages that change slightly, the deltas are on the order of a few TCP/IP packets. As about 32% of page accesses are first-time visits, about 68% of page visits are eligible for delta compression.

Read more

Suture CSS or JavaScript Files to Reduce HTTP Requests

A server-side variation of merging CSS and JavaScript files before uploading to the server is to do this digital suturing at the server. You can “suture” CSS or JavaScript files together before delivery from the server to save HTTP requests. Often developers create separate style sheets and scripts for organizational purposes, and import them into their pages as needed. There are two problems with this approach:

Read more

Refactor to Improve Code Design – software refactoring code to speed up javascript, java, and flash execution, download speed and coding changes

Refactoring is the art of reworking your code into a more simplified or efficient form in a disciplined way. Refactoring improves internal code structure without altering its external functionality by transforming functions and rethinking algorithms. Consequently, refactoring is an iterative process. By refactoring your JavaScript, Flash, and Java you can streamline its size, simplify your code, and speed up download and execution speed.

Read more

CSS: Substitute CSS2 Menus – replace graphic rollovers with css menus

Substituting CSS-based techniques for old-style graphic rollovers and DHTML menus is one of the most effective web site optimization techniques available. Graphic rollovers use “on” and “off” graphics to create rollover effects, with and without JavaScript. DHTML menus create nested menu structures with JavaScript, some of it complex. With the widespread adoption of CSS2-aware browsers, there is a better choice: CSS-based techniques. Substituting list-based markup, CSS2 to style, and an optional dash of JavaScript makes for fast, small, and accessible CSS menus.

Read more

JavaScript: Defer Execution – with the defer attribute of the script element

First introduced by Internet Explorer 4, the defer attribute of the script element is now part of the HTML 4 and XHTML specifications. The defer attribute gives a hint to the browser that the script does not create any content so the browser can optionally defer interpreting the script. This can improve performance by delaying execution of scripts until after the body content is parsed and rendered.

Read more

JavaScript: Delay Loading

You can make your content display faster if you delay or defer the loading of your external JavaScript files. JavaScripts are executed as they are loaded. Any external JavaScripts referenced within the head of your XHTML documents must be executed before any body content is displayed. One way around this is to delay the loading of your external JavaScript by using empty “stub” functions, and redefining these functions later on.

Read more