13 points · by jeswin · 12y ago · 13 comments
1. Processors are going to be fast enough to offset the rendering disadvantage that exists on the client now
2. Getting JSON data is just another request (or you could bootstrap on the page itself). In any case, you'd need to bring other files like CSS before the user can interact.
3. All crawlers will soon do AJAX, some are already doing this.
I know you're wanting to avoid doing unnecessary work, but I'd surmise the future you think is coming is far enough away that your site will be rewritten at least once between now and then.
http://en.wikipedia.org/wiki/Single-page_application
My tool of choice is jQuery Mobile. If it weren't for that I'd probably do AngularJS; whatever it takes to shift the processing to the client and make my life easier by not having to muck around in too much JavaScript code.
The point being that this approach works just fine for document centric sites.
Is it more important to shorten the time to display the current request, or to shorten the time for new pages to be rendered? Single-page apps marginally increase the current request's time-to-render in exchange for improving navigation between pages. For some purposes that provides a significant benefit, other times it doesn't.
If you want to participate in low-level crawling like for microformats/indieweb or similar things there is an advantage for static pages: you participate in a more democratic web not in one which just works for the big stacks.
Is there potential that clients will become 'close-enough'? Maybe, but I doubt the gap will ever be fully bridged.
As I understand it, Twitter tried full client-side rendering for a while and went back to a progressive enhancement model, because they noticed that an extra round trip of latency is enough additional load time to be noticed by the user.
HTTP/2 will shrink the benefit of first-load rendering further, but it's currently still an important consideration to make if load time is a primary concern.
Basically, you build your SPA in such a way that most major application entry point states are reflected in the URL (or at least URL+headers), use PhantomJS or something similar to capture and cache that page, and whenever the opportunity presents itself, serve up the cached version to the user so the SPA starts from that point very quickly.