Everything about Web and Network Monitoring

10 JavaScript performance tips

Javascript performance tips

Every week we cover JavaScript performance tips in our blog and this particular blog post is also dedicated to JavaScript performance. We’ve collected top 10 JavaScript performance tips that will improve your website’s performance.

1. Download Faster With A Few Adjustments

When web pages have high amounts of varying content, it can cause pages significant lag time. Components including images, style sheets and scripts often cause the loading process to slow down.

You can make your pages load faster by reducing the size of your images or changing the format from high-resolution JPEG files to GIF or PNG format.

You can also clean your code, ridding it of unnecessary characters, including tabs, spaces and comments. You can use one of the many free tools, like Clean CSS that reduces your code.

2. Using Image Maps May Not Be Worthwhile

Image maps can cause confusion for navigation to users of your webpage, and you want super-easy navigation. Image maps are good for displaying information in image format, but only with grouped images.

Another downside of using image maps is that they are difficult to create and time-consuming. There is a large amount of code — which can cause slower download and coordinates must have precision. Even when you can see the image map, it can look confusing.

New alternatives to image maps include programs such as CSS Sprites or using in-line images.

3. Displaying Images Without Causing Crashes

A web page that hosts many images eats up computer resources and can cause crashes. Keep crashes minimal by streamlining your code; keeping it simple and clean, host photos and other high-resolution images on independent sites. A better option is to use CSS Sprites, which allows you to combine an unlimited number of images while lowering the amount of HTTP requests for a single image, which speeds the load time of retrieving images from one source instead of combining from separate locations.

3. When Not Using JavaScript Is Better

JavaScript is a powerful tool used by many developers, but there are times that using it can slow down pages, or worse, a browser could disable it and make the page look off to users.

Make sure you absolutely need to use JavaScript, because it may have compatibility issues. If you can create a better result by using HTML and CSS, by all means use them, and only use JavaScript if the other way does not work.

5. Reduce Requests – Reduce Wait

Just like asking ten questions when one would suffice is the same principle of HTTP requests. When you receive all your information with one request, it makes load time faster.

For example, each HTTP request uses 500 bytes – and each received object uses 500 bytes plus headers. Each additional request sent uses more bytes instead of one 500 byte request and reply, you use thousands of bytes for the same-sized image.

Traditional imaging methods use spliced portions, which rejoins the pieces for end users. Each slice requires a separate request; where, using image maps, inline images or CSS Sprites reduces HTTP requests and speeds up the process by sending images in a single piece or fewer pieces.

6. Optimization Strategies for Better Performance

It is important to rework one area of your website at a time, so you can check what changes help load times, what elements you can work without and finding other time-consuming culprits, including server performance issues.

Some programs that can help in the server-side process include HTTPWatch and Fiddler. Cuzillion helps when you want to experiment with various configurations of your web page.

7. Best Third-Party Web Hosts

You can reduce your HTTP requests by using third-party services. Allowing a third-party to host your images and RSS feeds allows for one HTTP request and creates faster load times.

Some top third-party hosts allow users to look at your images in different sizes, according to their preferences.

Flickr provides hotlinks you can embed on your web page, but you cannot directly link to each particular size.

ImageShack offers free services, but you have to allow ads to show to enjoy that freedom.

Mobypicture hosts your photos, allows you to keep all rights to your content and does not sell anything without your direct permission.

Twitter has joined the image hosting game, but works with PhotoBucket so all the same rules apply.

When choosing third-party hosting make sure to read and heed all rules and regulations. If you worry about copyrights and the company selling your content, find hosting that allows you to keep all rights to your content and says so.

8. Ways to Reduce Image File Size

Large image files have the potential to overload servers and make web pages load slowly.

You can cut image sizes by using online services that make them smaller. Many online services allow you to resize your images on their site without having to sign up for use. A couple of sites you can try to get started include Shrinkpictures.com and JPEGreducer.com.

Another effective way to make images load faster is to change their format. You can use Paint or Photoshop to convert files from JPEG photo-quality images to lower resolution GIFs.

When changing images from JPEG to GIF you lose high-definition quality, so using a GIF works well for charts and 2-D images; whereas, JPEG preserves quality when needed.

9. Web Page Profile Tools

The best websites offer quality content, quickly. It is important for you to analyze your site to make sure download speeds stay fast. If you offer great information, but users have to wait, they often leave before the page loads. When you depend on revenue from your web pages, users leaving early make your money adventures slim.

Testing your web page loading time is usually a simple process. Monitor.Us provides a free enterprise-grade page load monitor for it’s users. The monitor  is testing not only JavaScript performance, but also a set of other important metrics such as the load speed of different elements on your website, how internal and external links are affected during loading etc.

10. Good Webpage Source Code Cleaners

Remember that jumbled, extensive or incorrect code causes your pages to load slower or not at all. Using a source code cleaner, helps you navigate your code, cut unnecessary information and find and correct errors.

HTML Optimizer at iWebTools site allows you to copy and paste your code, and it automatically optimizes your code. It may not look as good as before you inserted it, but it can make load times faster.

HTML Tidy checks and cleans source files and works well within deeply nested HTML. It also works on hard-to-read code, making it more comprehensive with user-selected options including indentation and word wrap.

Word 2000 HTML Cleaner works well for programmers who write code in MS Word 2000. For $79, you receive source code ready for use in ASP application. Obviously, this code cleaner targets a specific audience, but may help you save time with complex codes.

123 HTML Protector Software protects your web page code and prevents others from using your source code, scripts, links and images. With this program, it makes it difficult for users to manipulate your code, which could wreak havoc on your pages.

All these programs work well for new to experienced coders. HTML Tidy is the most straightforward and easy program for anyone that wants to clean their code without worrying about style and readability.

Rather you are just beginning your coding process or have written code for years, you can always find new resources to create effective, stylish and quick web pages.

We are currently running a poll on our website and we’d like to know your opinion on the most useful  performance tips. Please take a minute and vote for your favorite website performance tips. We appreciate your participation.


Post Tagged with

About zhirayr