JavaScript can benefit from many of the same speed optimization techniques that are used in other languages, like C and Java. Algorithms and data structures, caching frequently used values, for loop unrolling and hoisting, removing tail recursion, and strength reduction techniques all have a place in your JavaScript optimization toolbox. However, how you interact with the Document Object Model (DOM) in large part determines how efficiently your code executes. After all else fails, you can tune your JavaScript locally by tweaking for loops, using profilers, and refactoring. Here are some excerpts from WebReference.com.