Twitter Upgrades To Load Tweets Five Times Faster

Collaboration SuitesSoftware

Code will be executed on Twitter servers, not in users’ browsers

Twitter engineers have started an upgrade of the microblogging platform that will increase the page loading speed by an average of five times.

The performance boost is achieved by moving the rendering of the Twitter pages from the user’s browser to the server. Other changes include the disappearance of hashbangs (#!) from permalinks, and optimisation of the JavaScript code.

The upgrade will allow Twitter to take advantage of new browser technology and pave the way for fresh multimedia features.

Early bird gets the worm

Twitter, which has 10 million users in the UK, was built around a web application architecture that executed most of the code on users’ machines. According to the engineering manager of company’s web core team Dan Webb, the fully client-side architecture, while having a number of advantages, lacked support for various optimisations available only on the server.

Twitter decided to take the execution of JavaScript completely out of the render path. “By rendering our page content on the server and deferring all JavaScript execution until well after that content has been rendered, we’ve dropped the time to first Tweet [the amount of time it takes from navigation to viewing the first Tweet on each page’s timeline] to one-fifth of what it was”, said Webb.

The transfer to the servers also allowed Twitter to reduce differences in performance across browsers.

Another noticeable change is the simplification of permalink URLs, which will no longer use hashbangs (#!). “With hashbang URLs, the browser needs to download an HTML page, download and execute some JavaScript, recognise the hashbang path (which is only visible to the browser), then fetch and render the content for that URL,” explained Webb. Removing the need to handle routing on the client has contributed to the improvement in initial page-load performance.

Finally, by splitting the JavaScript into modules, engineers have enabled the client to only download the JavaScript necessary for the page to work, resulting in a smaller payload over the wire, fewer lines of code to parse and quicker execution times, Webb said.

Twitter will continue to roll out this new framework to the site in the coming weeks. Once the changes are in place, the company plans to implement partial page reloads and begin to overhaul the server side of the application.

Are you an expert on social networks? Take our quiz!

Read also :
Click to read the authors bio  Click to hide the authors bio