One of the most important architectural changes was that twitter.com became a client of its own API. It extracts data in the same way as a mobile site, applications for iPhone, iPad, Android, and other third-party applications. This change made it possible to allocate more resources to the API team, which has made over 40 fixes. At the initial loading of the page and at each customer inquiries, all data is extracted from the highly optimized JSON cache.
Much attention has been paid to optimizing work in the DOM. For example, delegation of events in all directions was implemented, which allowed using less memory without worrying about nested events. Most of our interfaces are built from reusable components, so event handling was centralized and delegated to several root nodes. It was also minimized the number of redraws in the formation of HTML-structures before they are implemented and merged with relevant data at the stage of rendering HTML-pages, and not using DOM-manipulation.
One of the most important functions of the new engine is the ability to embed third-party content directly on the site using tweet links to one of our content partners. For most of them, such as Kiva or Vimeo, the oEmbed standard was used, which makes it easy to make a JSON-P request to the domain of the content provider and embed content that will be received in response to the request. For other media partners, such as TwitPic and YouTube, known mechanisms for embedding resources that can be obtained from the URL were used, thereby reducing the network load and providing general acceleration.
Open source code