Twitter is reverting to a more traditional page architecture with less JavaScript

May 30, 2012 09:43 GMT  ·  By

A couple of years ago, Twitter introduced a massively redesigned site. The new site looked and felt different, but the biggest changes were underneath, the entire site was now a JavaScript app. The new architecture had its critics and its drawbacks, but it had several advantages too.

Now though, Twitter is doubling back and is using less JavaScript in the client than before. Instead, some pages are now rendered in the cloud and then served, and Twitter plans to do this for more sections of the site.

The end result is that Twitter pages will be simple HTML pages, with only some JavaScript code for interactive features. With much of the content and layout processed in the cloud, less is left to the browser and, unsurprisingly, this results in a massive performance boost.

"On top of the rendered pages, we asynchronously bootstrap a new modular JavaScript application to provide the fully-featured interactive experience our users expect," Twitter explained.

"This new framework will help us rapidly develop new Twitter features, take advantage of new browser technology, and ultimately provide the best experience to as many people as possible," it added.

"The first thing that you might notice is that permalink URLs are now simpler: they no longer use the hashbang (#!). While hashbang-style URLs have a handful of limitations, our primary reason for this change is to improve initial page-load performance," Twitter said.

Only the single tweet permalink pages use the new framework. It's easy to spot them too, they have a full URL rather than a dynamic hashbang one.

Previously and currently for most other pages, Twitter first serves a generic HTML page, the basic frame for any Twitter page. That page contains the main JavaScript that figures out what it needs to display and where to grab it. It then requests the necessary resources and renders the content.

With a traditional page, the entire content and layout is served as basic HTML and JavaScript only handles things like button, search boxes and so on. It's easy to see why this is faster.

In fact, you can actually see that the new pages are faster, Twitter says that the new pages load in a fifth of the time it takes with the old framework.