Content Delivery Network
One way to reduce the amount of time it takes for any browser around the world to download the JavaSript files is to use a Content Delivery Network (CDN) to host the files. As defined by wikipedia, a CDN is “a large distributed system of servers deployed in multiple data centers across the Internet.” The main purpose of a CDN is to be able to serve files to those requesting them from the closest geographical location.
CloudFront is a CDN backed by S3 buckets.
The following graph shows the results. Note, the times are in milliseconds and is for the total load time (resolve, connect, and download).
In all cases, the file loaded faster from the CloudFront compared to the S3 one. This is to be expected. What was surprising is how much faster the load times were in some regions.
Given this particular use case, where there is not a need to serve very large files like video, the cost for CloudFront is minimal. The current price is less than $0.25 for the first 10TB per month and is less than $0.03 per 10K request block (see actual pricing at http://aws.amazon.com/pricing/cloudfront).
Although using CloudFront would be an additional cost over using S3 directly, for this use case, the benefit makes it easy to justify.