Javascript is not the fastest of languages but it is one of the most adaptable and dynamic of languages. Because the script runs at run time there is no single compiled code base there for there is going to be some overhead assuming you are coding with industry standards.
Compression
One of the best ways to increase javascript efficiency that requires almost no time at all is to add all of your scripts into one file. Not only will this only send one request to the server it will allow you to compress all of the contents and greatly decrease the through the wire size of the content. (pending on your server zip settings) Compressing code will remove everything that is not required to run the script such as white space and comments. Compressing the code in this way will also change the names of variables and functions to shorten the file as much as possible.
Here is an excellent application created by google that will allow you to compress the javascript file. http://closure-compiler.appspot.com/home
Efficiency
Another way to greatly improve efficiency within a js file is to decrease repeated operations as much as possible. This consists of optimizing object handlers and adding dynamic event listeners in larger applications. Should you be using set interval it is a good idea to lessen the amount of times that the value is refreshed by. An animation of ui elements do not require a high frame rate to seem impressive.
Profiling and Debugging
Many developers like to use an application called FireBug. I prefer to use the built in utilities that come along with Google Chrome. Both of these options allow profiling and debugging options for your javascript application along with a console that allows you to trace methods and objects within your development process.
Unit Testing
The final thing that I would like to mention for those using javascript at home or in the office is that they should use unit tests to make sure that their code is solid and stable. There is a full set of how you can use JsUnit to tests here.
Related posts: