3 ms·
You're confusing server CPU usage with scalability and performance. HTML template rendering on either the server or client is embarassingly parallel, as it jus
by mantrax4 13y ago
You're confusing server CPU usage with scalability and performance.
HTML template rendering on either the server or client is embarassingly parallel, as it just takes a viewmodel (basically) and populates a template of HTML with its variables, with zero other calls and dependencies.
You can scale this particular step to infinite number of servers, without any bottleneck appearing (hence, it's horizontally scalable).
And HTML template rendering on the server can be faster, because for client-side rendering you need at least two roundtrips to the server (fetch template, one; fetch content via JS, two), and for complex apps this becomes tens of HTTP requests (side panels, user context, footers, menus etc.), versus just one roundtrip for a server-based approach.
Request/response lag is critical in the way an app is perceived.
Also when it comes to CPU, as I already said in my previous response, view rendering is the cheapest step computationally you have in an app. Any other service takes more time and resources than that. So view rendering is never the bottleneck, and "optimizing" it away with complicated client-side shenanigans is the very definition of premature optimization.
- bhantol 13y ago"And HTML template rendering on the server can be faster, because for client-side rendering you need at least two roundtrips to the server (fetch template, one; fetch content via JS, two), and for complex apps this becomes tens of HTTP requests (side panels, user context, footers, menus etc.), versus just one roundtrip for a server-based approach." Nope. The template fetch is only the first time. Because the template/HTML is either cached on the browser or is compiled/inlined with the Javascript with the build pipelines. "Request/response lag is critical in the way an app is perceived." Yes it is and it is worse with server rendered pages. A typical size of a page fully dynamically generated on the server side could be a few times larger than that fetching of data/content.