3 ms·
Another reason is that this style of programming makes it very difficult to improve your TTFB (time to first byte). If the entire document can be manipulated at
by michaelmior 13y ago
Another reason is that this style of programming makes it very difficult to improve your TTFB (time to first byte). If the entire document can be manipulated at any time, you can't start sending anything to the browser until all your processing is done. This means a lot of unnecessary buffering on the server side and ultimately a delay in pushing data to the client. Modern browsers do pretty well at rendering incomplete HTML, so the faster you can start sending data, the faster the page load will be perceived.
- slashnull 13y agoI actually didn't know web servers started sending packets before I was done with writing to the stream. Interesting.
- michaelmior 13y agoThis depends on the configuration of both your web server and your application server. There's a good chance things won't work this way out of the box. But this is generally something that you want for high performance.