NEWS CATEGORIES:



NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
Home / News / Webmaster / Tips and Tricks

Tips and Tricks


The Free Super Mario Game: Only 14kB

The advantages of Javascript optimization

By Catalin Bocanu, Web News Editor

9th of April 2008, 15:46 GMT

Adjust text size:


Super Mario Javascript
Enlarge picture
Every Internet user likes fast loading online games, web pages or other applications. The secret of web pages and application optimization resides greatly in code structure.

JavaScript, as a client-side programming language, is widely used
for addition of various features and functionalities to websites. There are many aspects that influence the final script size. The aim of code optimization is to reduce the file size of the script in order to decrease the page loading time and bandwidth consumption.

The compression tools available as desktop applications, standalone scripts and free online services, will optimize the entire structure of the JavaScript code. As a consequence, the code optimization utility will remove white spaces, comments, obfuscate local variables with shorter variables names and more.

Usually, compression of Javascript code will allow you to obtain a reduction of final file size with up to 50 percent as compared to the original version. Of course, the initial selection of coding algorithm and variables name will also influence the compression effect.

For example, Super Mario Game is a single Javascript file that in uncompressed form has 35 kb. The game does not use external image files (the entire game is rendered with the help of JavaScript) and the music is included as encoded data. All aspects related to the code structure were optimized from the beginning, like game sprites reprezented in encoded strings determining their size of only 60 bytes for a single sprite. After the code compression with YUI compressor, the JavaScript file size was 14 kb.

In conclusion, the optimization of Javascript code through specific compression methods will show the best results (as the decreasing of initial file size with 50%) if the initial code has a certain optimization degree from the project design phase. The Javascript as well as HTML and CSS code could also support compression on the server side, but not all browsers have the capability of decompressing the files on the client side.

TAGS:

JavaScript Games | Game Code | Free Game | Super Mario | Javascript Optimization
Read by 8,314 user(s) | Add comment | Link to this article TWEET THIS


Article rating:
Very Good (4.1/5) 6 vote(s)    

Subscribe to news | Print article | Send to friend

© Copyright 2001-2009 Softpedia
Contact:

 

 

SEARCH THE NEWS ARCHIVE :




Today's News
| Yesterday's News | News Archive


MORE RELATED ARTICLES:


Free Download Jabber Clients Made With Javascript

How To Add Google Gadgets in Joomla!

Automatic Text Translation with Javascript

Get A Free Flash Image Gallery

An Unwanted Trip To A Porn Website ?

A Few Guidelines to Build A New Website

Get The Optimal Free PHP Web Hosting Service

Bookmark Management and Sharing with del.icio.us

Automatically Elaborate and Publish Flash Quizzes without Programming Knowledge

A Simple Javascript Example

User opinions:

No user comments yet.
Be the first to express your opinion using the form below!

Share your opinion:

Your Name:
Your Email Address:
(will not be used for commercial purposes)
Solve this to prove you're not a bot: =
Your review/opinion:

 




Windows tabGames tabDrivers tabMac tabLinux tabScripts tabMobile tabHandheld tabGadgets tabNews tab

SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   ENTER NEWS SITE   |   ENGLISH BOARD   |   ROMANIAN FORUM