Website Performance Optimization: Tutorial and Course

Website Performance Optimization: Tutorial and Course - Website Performance Optimization Tutorial and Website Performance Optimization Course, The Ultimate Guide to Website Performance Optimization. Learn Website Performance Optimization Tutorial and Website Performance Optimization Course at Website Performance Optimization Tutorial and Course.

Website Performance Optimization Tutorial and Website Performance Optimization Course

Website Performance Optimization: Overview

Website Performance Optimization Tutorial and Course - Website Performance Optimization tutorial and Website Performance Optimization course, the ultimate guide to Website Performance Optimization, including facts and information about Website Performance Optimization. Website Performance Optimization Tutorial and Course is one of the ultimate created by to help you learn and understand Website Performance Optimization and the related SEO technologies, as well as facts and information about Website Performance Optimization.

Website Performance Optimization Tutorial, Website Performance Optimization Course

Website Performance Optimization: Tutorial and Course - Website Performance Optimization Tutorial and Website Performance Optimization Course by , The Ultimate Guide to Website Performance Optimization.

Website Performance Optimization: Tutorial and Course

What Is Website Performance Optimization?

Website performance optimization streamlines your content to maximize display speed. Fast display speed is the key to success with your website. Website performance optimization increases profits, decreases costs, and improves customer satisfaction, as well as improving your website's search engine rankings, accessibility, and maintainability.

Streamlining transforms your pages to display navigable content faster, and to defer or delay off-site content. In this Tutorial and Course for Website Performance Optimization, you'll learn how to reduce HTTP requests, convert to semantic markup to more easily style with Cascading Style Sheets (CSS) (), optimize graphics and multimedia, and defer or delay the loading of off-site content.

Using the best practices In this Tutorial and Course for Website Performance Optimization, you'll transform your HTML and multimedia to give your site more hurtle and less turtle. First, let's explore some common web page problems and trends that confront web performance engineers.

People don't like to wait, especially online. If a web page takes too long to load, visitors simply leave and often don't come back. 'Slow' is the biggest frustration on the web. Load time is directly related to the financial performance of the website.

Studies show that users leave a site if it hasn't loaded in 4 seconds; keep your users happy and engaged by providing a fast performing website!

Amazon noticed a 1% drop in sales for every 0.1 second the site loaded slower. In an AB test, Google raised the number of search results per page from 10 to 30. Load time went up from 0.5 to 0.9 seconds average. The number of search results and ad revenues dropped 20%!

Google has announced that they are using page speed in their ranking algorithm, as their philosophy says: "Fast is better than slow."

Reasons Why You Need Website Performance Optimization

Website Performance Optimization: Common Web Page Problems

The size and complexity of the markup that you use in your web pages determine, for the most part, their initial display speed. Pages that are large and complex, especially those with nested tables and mispositioned CSS and JavaScript files, delay the time it takes for useful content to display. Sleek and streamlined pages feel faster because of quicker feedback through progressive display. The idea is to streamline your markup using standards-based techniques and let your code get out of the way of your content.

80% of web page response time is in the content. Most of this time is spent dealing with the objects that make up a web page. As the number of objects per page increases beyond four, object overhead dominates total web page delay.

Most popular web pages go well past this threshold, averaging more than 50 objects per page and more than 300 KB in total file size. Improperly coded, Ajax-enhanced pages can slow down interactivity, even after the page has loaded.

Clearly, there is much room for improvement in the performance of the average website.

Website Performance Optimization: Oust Oodles of Objects

With the advent of Ajax, DHTML, and Web 2.0 mashups, some web pages have turned from simple HTML documents into full-blown interactive applications. With this increased complexity comes a cost: larger web pages. The number of external objects has grown accordingly as web pages have become more complex. Each additional object adds one more HTTP request and more uncertain delay.

Each object adds latency to your load time, increasing it an average of 0.25 seconds per object on dial-up and 40 ms on cable. Overseas users suffer the most from object overage because long-distance connections require more hops and present more opportunities for data loss.

Website Performance Optimization: Untangle Tables

Tables are a poor substitute for CSS layout. Despite the widespread adoption of CSS, 62.6% of web pages still use tables for layout. The average table depth has decreased by half since 2006, from nearly 3 to about 1.5. Complex nested tables can cause rendering delays with browsers because tangled tables must be parsed and rendered before your content displays.

Some database-driven sites create table-based content modules that are assembled on the fly into table-based templates. All of these nested tables will bog down browsers and overwhelm your content-to-code ratio. This reduces the potential search engine rankings of your web pages.

You can reduce the depth of nested tables by styling, labeling, and positioning content areas with CSS and using simpler skeleton tables for layout.

Website Performance Optimization: The Growth of Graphics

The average web page has more than 54% of its page weight in graphics. In fact, more than 60% of the pixels above the fold are used by graphics on the average web page. Unfortunately, many of the graphics on the Web are fat and unoptimized. As digital camera resolution has increased, the file size of digital originals has ballooned, and some online graphics exceed 1 MB.

Website Performance Optimization: The Growth of Advertising

Most popular media and blog sites use image-heavy advertising to generate revenue, at a cost of about one-sixth more objects and one-third more latency. Without ad size policies in place, the total impact of advertising can become even more significant. If you use graphical ads, set file size criteria for the banner ads of your advertisers, criteria that are appropriate to banner dimensions. The growth in the number and size of advertisements has caused significant delays for users. However, displaying ads also incurs the overhead of remote network hosting (in most cases) and additional logic to deliver ads to the screen (usually done with JavaScript). Remote JavaScript is the most inefficient ad delivery method, yet it is in widespread use because of its convenience.

Website Performance Optimization: The Growth of Multimedia

The popularity of Flash and the likes of YouTube, Yahoo! Video, and MySpace have increased the use of multimedia on the Web. As broadband penetration has increased, videos have grown in size, bit rate, and duration.

The majority of multimedia traffic comes from files that are larger than 1 MB, but most requests come from files smaller than 1 MB. More than 87% of all streaming media is abandoned by users in the first 10 seconds, however, wasting up to 20% of server bandwidth. Although only 3% of server responses are for videos, they account for 98.6% of the bytes transferred. So, although videos account for a small percentage of requests, they make up the majority of the traffic on the Web.

Overall, for videos longer than 30 seconds, about 13% of home and 40% of business users experience quality degradation with their streaming media, caused by rebuffering, stream switching, and video cancellation. For sessions longer than 300 seconds, the results are even worse.

Website Performance Optimization: How to Optimize Your Web Page Speed

To optimize your web page speed, start by stripping out all inline style. Pare down your markup to pure HTML structure. Next, look at your page to see whether any elements can be created by more efficient means. You can often morph HTML structural elements with CSS to replicate table-based elements more efficiently.

After your code has been stripped of style and refactored, convert that embedded style into rule-based CSS. To enable progressive display, position CSS files in the head and JavaScript files at the end of your body code. Minimize the number of HTTP requests by combining files, and by converting graphical text to CSS text. Use CSS spacing, CSS sprites, image maps, and background colors to save requests. Optimize any remaining images and multimedia to the lowest acceptable quality and frame rates. Enable caching for persistent objects and distribute them over different servers to minimize latency. Finally, use HTTP compression to shave an average of 75% off HTML, XHTML, CSS, and JavaScript file sizes.

Website Performance Optimization: Switch to HTML5

HTML5 supports a number of new semantic elements, as well as several related technologies and APIs. These additions and changes to the language have been introduced with the goal of allowing developers to build web pages that are easier to code, use, and access.

These new semantic elements, along with other standards such as WAI-ARIA and Microdata, help to make our documents more accessible to both humans and machines, as well as resulting in benefits for both accessibility and search engine optimization.

The semantic elements, in particular, have been designed with the dynamic Web in mind, with a particular focus on making pages more accessible and modular.

Finally, the APIs associated with HTML5 help improve on a number of techniques that web developers have been using for years. Many common tasks are now simplified, putting more power in developers’ hands. Furthermore, the introduction of HTML5 audio and video means that there will be less dependence on third-party software and plugins when publishing rich media content on the Web.

Overall, there are good reasons to start looking into HTML5's new features and APIs, and we'll discuss more of those reasons as we go through the Tutorial and Course for HTML5.

Website Performance Optimization: Switch to CSS3

CSS3 contains just about everything that's included in CSS2.1, the previous version of the spec. It also adds new features to help developers solve a number of presentation-related problems without resorting to scripting plugins or extra images.

New features in CSS3 include support for additional selectors, drop shadows, rounded corners, updated layout features, animation, transparency, and much more.

In the past, in order to create gradients, shadows, and rounded corners, web designers have had to resort to a number of tricky techniques. Sometimes extra HTML elements were required. In cases where the HTML is kept fairly clean, scripting hacks were required. In the case of gradients, the use of extra images was inevitable. We put up with these workarounds, because there was no other way of accomplishing those designs. CSS3 allows you to include these and other design elements in a forward-thinking manner that leads to so many benefits: cleaner markup, maintainable code, fewer extraneous images, and faster-loading pages.

Overall, there are good reasons to start looking into CSS3, and we'll discuss more of those reasons as we go through the Tutorial and Course for CSS3.

Website Performance Optimization: Minimizing HTTP Requests

Each unique object in a web page requires a round trip to the server, that is, an HTTP request and a reply. Each object introduces indeterminate delays. When the number of objects is greater than four, object overhead dominates page download times.

By minimizing the number of objects in your web pages, you can minimize the number of HTTP requests that are required to render your page and thus reduce object overhead. By requiring fewer HTTP requests, you'll speed up load times and make them more consistent.

The key to minimizing HTTP requests is to combine files and convert graphics-based techniques to CSS. You can convert graphical text to CSS text; combine external images, scripts, and CSS files; and eliminate frames and JavaScript includes. Convert spacer cells into CSS margins, and replace JavaScript behavior with CSS :hover techniques. Combine multiple decorative images into one CSS sprite.

Website Performance Optimization: Converting Graphical Text to Styled Text

Graphical text is often used for headers or menu items to achieve a certain look. As yet, search engines can't read text embedded in graphics. Rasterized text also introduces unnecessary HTTP requests. You can instead use CSS to style headers, or use an image replacement scheme. By converting to CSS text, you lose some control but gain in speed, potential search engine rankings, and accessibility.

Use text overlays. One variation on this theme is to separate graphical text from background images. To achieve high-quality text in a JPEG you need to increase the quality of the entire image so that it is higher than it needs to be, or use regional compression. In some cases, it may be more efficient to remove the text from the JPEG and overlay the text as either CSS text or, as a last resort, a transparent GIF or PNG with the text embedded in the image. With a graphical text overlay you trade an additional HTTP request for a smaller background image. A CSS text overlay avoids this trade-off.

Website Performance Optimization: Converting Spacer Cells to CSS Margins or Padding

A common practice is to use spacer cells with a single-pixel GIF that is stretched to enforce the spacing distance. But a better way would be to use CSS to add spacing between cells, and even better is to use relative "em" spacing to allow for changes in font size made by the user and div elements.

Website Performance Optimization: Combining Remaining Images and Map or Sprite

You can reduce the number of HTTP requests that your pages require by combining adjacent images into one composite image and mapping any links using an image map. Instead of multiple HTTP requests, this technique requires only one.

Website Performance Optimization: Combining and Optimizing CSS and JavaScript Files

Many developers create separate stylesheets and import them into their pages as needed. There are two problems with this approach:

Combining files in the head of your HTML documents can avoid these problems. Browsers must load and parse external CSS files referenced within the head of your HTML before they parse the body content. By minimizing the HTTP request load, you can maximize the initial display speed of your content.

Website Performance Optimization: Eliminate Iframes and JavaScript Includes

More than 52% of web pages use frames, the vast majority of which are iframes used to display advertising. Frames, iframes, and JavaScript includes can be especially harmful to web performance because they introduce extra HTTP requests and can include entire web pages within other web pages.

For advertising, you can eliminate the extra HTTP requests required by the preceding methods by using a server-side include-based ad delivery system. This technique uses server-side includes (SSIs) to include the banner ad directly into the page, saving an HTTP request. There is an increase in speed after switching from JavaScript-based ad serving to SSI-based ad serving, and the idea is to shunt work to the server in exchange for less work for the browser.

Website Performance Optimization: Optimizing Images

Many sites use full-size unoptimized or partially optimized JPEGs resized into small thumbnails with height and width dimensions. These files can be more than 1 MB in size, that is around a hundred times larger than these files need to be.

A better way is to crop and resize your images to the final dimensions that you want them to assume on your page. Then optimize them in a good-quality graphics program such as Photoshop or Fireworks. You can achieve higher compression ratios using specialized graphics tools. The idea is to reduce the image to the lowest acceptable quality and resolution for the Web (72 dpi).

You can often switch formats to save even more bytes. For example, you can often substitute PNG-8s used with or without dithering for JPEGs or GIFs at smaller file sizes.

TIFFs, BMPs, and maximum-quality JPEGs are unsuitable for the Web. Switching to a different format can make a significant difference in file size. The PNG is smaller than the GIF at equivalent settings. For most flat-color images PNGs are 10% to 30% smaller than GIFs due to PNG's superior compression algorithm.

Here is a summary of the techniques you can use to fully optimize your images:

Website Performance Optimization: Optimizing Multimedia

Multimedia makes up only a small portion of server requests but accounts for the majority of traffic on the Internet. So, the optimization of streaming media has become more important in maximizing web page speed and reducing bandwidth usage.

Website Performance Optimization: Optimizing Videos

Movies optimized for the Web should be short in duration, small in dimension, and optimized with the appropriate codec. We have seen videos 10 to 30 minutes long automatically loaded and playing into home pages, some 50 MB to 175 MB in file size. Although this may grab the attention of high-bandwidth users, it is better to respect your visitors' bandwidth and provide a static placeholder image and a play button. A best practice is to allow users to choose different size movies to better match their bandwidth abilities. Sizes from "small" (320×240 pixels) to "HD" (1,920×1,080 pixels) can be viewed. Overall, this was a lot of up-front work; it had to compress one movie many different times, into many different sizes. However, the extra work pays off with satisfied site visitors who are able to find content that meets their needs and the amount of bandwidth available to them. For more information about Video optimization, please visit Tutorial and Course for Video Optimization created by SEO University.

Website Performance Optimization: Optimizing Flash

Some typical problems we see with Flash are unoptimized images and too many frames instead of tweened symbols. A tween is the calculation of all the changes between frames, which is more efficient than having a lot of frames instead. You can significantly reduce the file size of Flash movies by optimizing your images in Photoshop, not in Flash. Reduce the number of frames, minimize the number of fonts, and tween between symbols. For more information about Flash optimization, please visit Tutorial and Course for Flash Optimization created by SEO University.

Website Performance Optimization: Converting JavaScript Behavior to CSS

Embedded JavaScript is widely used on the Web, with 84.8% of pages using some JavaScript.

JavaScript is used for form validation, menus and rollovers, browser sniffing, statistics, and more complex Ajax applications. You can accomplish a number of these techniques with more efficient methods, for more information, please visit AJAX Optimization.

You can use CSS to control drop-down menus and rollovers with the :hover pseudoclass, for more information, please visit .

Website Performance Optimization: Using Server-Side Sniffing

Browser sniffing is one area where JavaScript is in widespread use. To minimize the JavaScript overhead that your users must download, you can substitute server-side or PHP and JSP sniffing instead. You can uses server-side browser sniffing or hybrid sniffing tools to detect a wide variety of parameters, including Flash, screen size, connection speed, cookies, and browser and software versions.

You can also create environment variables that closely mimic JavaScript-based sniffing by using conditional server-side includes (XSSIs). Now you can use these XSSI variables to conditionally include code within your XSSI includes without the need for JavaScript:

<!--#if expr="${isIE}" -->
<!--#elif expr="${isOPERAMAC}" -->
<!--#elif expr="${isOPERA}" -->
<!--#endif -->

It is faster to set environment variables at the server by configuring your httpd.conf file using BrowserMatchNoCase . For example:

BrowserMatchNoCase "MSIE [4-11]" isIE
BrowserMatchNoCase Mac isMAC
BrowserMatchNoCase Opera isOPERA

Website Performance Optimization: Optimizing JavaScript for Execution Speed and File Size

After replacing as much JavaScript as possible with CSS and server-side techniques, optimize any remaining JavaScript to minimize file size. You can use abbreviated object, variable, and function names to shave bytes.

Beyond minifying JavaScript, you can often refactor or rewrite procedures with less code to accomplish the same thing. Remember to measure first, then optimize. You can use a JavaScript profiler to locate performance bottlenecks.

Loop optimizations such as unwinding can also help you to gain some cycles to increase your JavaScript execution speed. Often, built-in functions perform faster than hand-crafted code. Finally, combine and compress external JavaScript files to save HTTP requests and bandwidth where possible.

Website Performance Optimization: Converting Table Layout to CSS Layout

Using CSS to lay out your page can save you a significant amount of markup, typically 25% to 50%. First look at the layout to see whether you can substitute CSS lists and positioned div s to simulate the effects that are typically done with tables. Next, strip down the content to structural markup and build it back up again using CSS style and positioning. Then test the new layout with different browsers.

You can use CSS to position your entire layout or to format smaller sections of your web pages. We often see tables used to format pages when CSS could have been used more efficiently. You can create multicolumn layouts using CSS floats and margins applied to divs. You can make complex hierarchical menus by using lists controlled by CSS, not lists controlled by JavaScript.

Website Performance Optimization: Replacing Inline Style with CSS Rules

Replacing table layout with CSS layout certainly saves you bandwidth and reduces maintenance headaches. Stripping down your markup to bare structure and replacing any inline style with CSS rules will help fully optimize your HTML. For more information about replacing inline style with CSS rules, please visit .

Website Performance Optimization: Minimizing Initial Display Time

You can improve the perceived speed of your web page by loading something useful fast. You can ensure that your useful content (i.e., content that users can navigate with) loads quickly by layering your tables or divs.

Multimedia can also benefit from fast start techniques. Flash presentations can load a separate file quickly while others stream in the background. Movies can load a static placeholder image or preview to show something quickly to help engage the user.

Website performance optimization is not only about raw speed, but also about managing your users' experience.

Website Performance Optimization: Loading JavaScript Wisely

External scripts referenced in the head of your pages are especially harmful because they delay the display of your body content. Delays before your body content displays make it more likely that users will bail out. Human-computer interaction (HCI) research has shown that delays before viewing pages are less frustrating than delays after a page has loaded.

Post-loading delays are a common problem with Ajax-enabled pages. When it is poorly written, Ajax can make things especially difficult on narrowband users. Even with HTTP compression, the latency due to grabbing all those separate files can cause indeterminate delays. Ajax also introduces polling with the XMLHttpRequest object (XHR).

Webmasters are outsourcing web services with widgets. Widgets are third-party gizmos that embed everything from Google AdWords, Flickr images, and Twitter tweets to iTunes playlists. The problem with widgets is that they can delay the display of your web pages by many seconds and increase delay variability. Widgets are typically used with a snippet of external JavaScript, and their performance relies on the response time of the external server providing the service. Most web service providers lack the extreme data-farm resources and thus the responsiveness of a company such as Google. We’ve seen external survey widgets, Technorati blog tracking code, and even Google Analytics when it first launched actually hang browsers and cause web pages to time out. Removing these widgets or moving these third-party tags to the end of your markup can help to minimize customer impact.

However, there is a better way. By using Widget Enabled DOM JavaScript Embedding (WEDJE), you can rewrite the widget embed code to effectively make your JavaScript work asynchronously. WEDJE creates a cross-platform, cross-browser defer by using the document object model (DOM) to append a div, create a script element, and then append the script element to the div , all with JavaScript. When these elements are linked together in this way, browsers appear to decouple the loading and execution of the attached JavaScript, making widget execution asynchronous!

Another option is to use iframes to load ads, but iframes can ruin the context-sensing abilities of contextual ads and so you must use them carefully.

Website Performance Optimization: Summary

Website performance optimization streamlines your pages to download and display faster. As your website performance improves, your bailout rates and bandwidth bills will go down while your conversion rates and profits will rise. In this Tutorial and Course for Website Performance Optimization, you have learned how to minimize HTTP requests, optimize graphics and multimedia, substitute server-side for client-side sniffing, and load JavaScript wisely.

To reduce the overhead of multiple objects that causes the majority of web page delay, minimize the number of objects referenced within your web pages. Also, put all of your images, still and motion, on a strict file size diet. Minimize the size of the head of your HTML, and layer your markup to display useful content quickly and maximize your potential search engine rankings. Finally, move your CSS to the top and your scripts to the bottom of your pages to enable progressive display.

To maximize web page display speed, you can employ the following 47 website performance optimization techniques:

Website Performance Optimization: Further Reading