Engineer in Tokyo

Twitter Page Code

Twitter

I took a look at the code of a Twitter page as an example of a site that gets lots of traffic and noticed a couple of things.

  1. They use Amazon S3 to store images
  2. They split the JavaScript, favicons, and CSS up across 3 or 4 subdomains (assets0.twitter.com, assets2.twitter.com, etc.)
  3. They include prototype and a version of jQuery as well as a version of script.aculo.us.
<script
    src="http://assets3.twitter.com/javascripts/prototype.js?1213829093"
    type="text/javascript"
></script>
<script
    src="http://assets1.twitter.com/javascripts/effects.js?1213829093"
    type="text/javascript"
></script>

<script
    src="http://assets0.twitter.com/javascripts/application.js?1213829093"
    type="text/javascript"
></script>
<script
    src="http://assets0.twitter.com/javascripts/jquery-1.2.3.min.js?1213829093"
    type="text/javascript"
></script>

It kind of surprised me that they include a version of prototype AND jQuery AND script.aculo.us since they aren’t really light JavaScript files. Prototype comes in at 123 kilobytes, jQuery is 53 kilobytes, and script.aculo.us is 38 kilobytes. Seems to me that even with caching and all they could significantly reduce download traffic by sticking to one JavaScript library. I’m sure there is some weird reason they do it though.