5 Markup Optimization Tips

Posted: March 17th, 2010
Filed under: Web Speed and Performance
Tags: ,

Typical markup is either very tight, hand-crafted and standards-focused, filled with comments and formatting white space, or it is bulky, editor-generated markup with excessive indenting, editor-specific comments often used as control structures, and even redundant or needless markup or code. Neither case is optimal for delivery. The following tips are safe and easy ways to decrease file size:

1. Remove white space wherever possible

In general, multiple white space characters (spaces, tabs, newlines) can safely be eliminated, but of course avoid changing <pre>, <textarea>, and tags affected by the <white-space> CSS property.

2. Remove comments

Almost all comments, save for client-side conditional comments for IE and doctype statements, can be safely removed.

3. Remap color values to their smallest forms

Rather than using all hex values or all color names, use whichever form is shortest in each particular case. For example, a color attribute value like #ff0000 could be replaced with red, while lightgoldenrodyellow would become #FAFAD2.

4. Remap character entities to their smallest forms

As with color substitution, you can substitute a numeric entity for a longer alpha-oriented entity. For example, &Egrave; would become &#200;. Occasionally, this works in reverse as well: &#240; saves a byte if referenced as ð. However, this is not quite as safe to do, and the savings are limited.

5. Remove useless tags

Some “junk” markup, such as tags applied multiple times or certain <meta> tags used as advertisements for editors, can safely be eliminated from documents.

A compiler tool such as Port80’s w3compiler can remove redundant structures from your code before you load files on the server — creating optimized, exact duplicates of your pages ready for fast delivery and rendering on any Web browser. For full performance optimization on the Windows Web server side, make sure to try httpZip for HTTP compression & acceleration and CacheRight for cache control management for developers as well.

/ P80

No Comments »

Comments are closed.