Speeding up JavaScript delivery through automatic compression and browser caching
JavaScript was originally an interpreted language, but V8 and JIT compilers are now replacing the interpreters. V8 JavaScript engine, originally introduced in Google Chrome and Chromium is a trendsetter; it compiles JavaScript to native machine code. As the Web keeps on evolving, there will probably be more powerful JavaScript compilers coming up sooner or later.
Whether the browser has compiler or interpreter, the JavaScript code has to be downloaded in the client machine before it gets executed. This necessitates quicker download, which in turn means less code size. The quickest and most common approaches to achieve less code space and quicker loading are:
Strip off whitespaces, newlines, and comments—this is possible through minification tools such as JSMin, Packer, Google Closure compiler, and so on.
Code compression through
gzip
—all modern browsers supportgzip
content encoding and this allows the content...