Simply because Web performance really matters !
99% times it will give you faster end-user response times.
Here are a few exampels from Velocity Conf.
- Bing – A page that was 2 seconds slower resulted in a 4.3% drop in revenue/user.
- Google – A 400 millisecond delay caused a 0.59% drop in searches/user.
- Yahoo! – A 400 milliseconds slowdown resulted in a 5-9% drop in full-page traffic.
- Shopzilla – Speeding up their site by 5 seconds increased the conversion rate 7-12%, doubled the number of sessions from search engine marketing, and cut the number of required servers in half.
- Mozilla – Shaving 2.2 seconds off their landing pages increased download conversions by 15.4%, which they estimate will result in 60 million more Firefox downloads per year.
- Netflix – Adopting a single optimization, gzip compression, resulted in a 13-25% speedup and cut their outbound network traffic by 50%.
From Steve Souders, pioneer in Web Performance Optimization,
80-90% of the end-user response time is spent on the frontend - Start
here first.
Using external files produces faster pages because the JavaScript and CSS files are cached by the browser/networks/proxies (as defined in HTTP protocol with Cache headers). JavaScript and CSS that are inlined in HTML documents get downloaded every time the HTML document is requested. This reduces the number of HTTP requests that are needed, but increases the size of the HTML document. If you're using Jquery-like scripts, it's easy to refrence 300 KB of scripts and do not believe that everyone has a 100 MBits/s bandwidth with low latency, running a single application -the browser- opened on your web site. 99% times it will give you faster end-user response times.
The frequency with which external JavaScript and CSS components are cached relative to the number of HTML documents requested is also important. If users on your site have multiple page views per session and many of your pages re-use the same scripts and stylesheets (bundles), there is a greater potential benefit from cached external files.
But inlining is -sometimes- preferable for single page application or web sites with one single page view per session. There is no golden rule, and generally forget it as it concerns mainly very specific web sites really involved by end-user performance.
You can read here why performance matters (Disclaimer : I am the author)