4 ms·
Wouldn’t a traditional website be even worse then? Instead of loading some JSON from the API it has to load the entire page, parse all of the CSS and JS again (
by cyral 5y ago
Wouldn’t a traditional website be even worse then? Instead of loading some JSON from the API it has to load the entire page, parse all of the CSS and JS again (the “time to first paint” or “time to interactive” benchmarks are all about that) A SPA only has to do that once. A lot of frameworks bundle various parts of the website actually, so the “shell” of the Twitter feed is loaded initially and the content is dynamically added to it when you navigate through tweets (just as the native app would), but then loading the shell of lesser used areas like your account settings would be deferred until needed. (So you aren’t really downloading a huge JS bundle on first load)
Also I think the reason it has to load the tweets again is to not serve stale content. They could have the browser cache it using the same cache control mechanism as a page load if they wanted.