<story><title>Conservative web development</title><url>https://drewdevault.com/2018/09/04/Conservative-web-development.html</url></story><parent_chain><item><author>zelon88</author><text>Your math sounds wrong, so I did it on paper and proved that it&amp;#x27;s wrong.&lt;p&gt;The average bandwidth for a mobile device in the USA is about 3.25 mb&amp;#x2F;s (26mbps). So to load your &amp;quot;2-4mb&amp;quot; Javascript library you&amp;#x27;re looking at 400ms to connect + 1000ms to download resources. That&amp;#x27;s 1400ms.&lt;p&gt;Now for the rest of the math I benchmarked my own website. My homepage is ~300kb and loaded in 461ms. The fastest you&amp;#x27;re going to get ANYTHING back from my server is about ~170ms.&lt;p&gt;Lets start with your App. 1,400ms and the app is loaded. Load another page and it takes 200ms to load another 5kb of content. Load one more page and it&amp;#x27;s another 200ms for 5kb of content. I&amp;#x27;ve been waiting on your website for a total 1,800ms and viewed three &amp;quot;pages&amp;quot; of content.&lt;p&gt;Lets move on to my website. ~450ms and the site is loaded. Load another page and it takes another ~450ms to load another 300kb. Load another page and that&amp;#x27;s another ~450ms to load another 300kb. I&amp;#x27;ve been waiting on my website for a total of 1,350ms and viewed three actual pages of content, but the user only had to download 900kb instead of 4mb.&lt;p&gt;So I think you proved the OP&amp;#x27;s point.</text></item><item><author>coding123</author><text>There are two different kinds of web development:&lt;p&gt;a) Apps where the user is expected to stay a while&lt;p&gt;b) Sites where the user is there, maybe once ever (most likely also scared off by the ads)&lt;p&gt;For Apps, I would always prefer a pre-load of JS that was built with React and downloads about 2-4 MB. If there is an update I will be forced to download it again.&lt;p&gt;On the UPSHOT, almost everything I do in that app is now a 3-8KB request. This means transitioning pages, changing states of things, all happen in about 50ms including whatever visual changes are required on the screen.&lt;p&gt;Compare that to full-screen refresh apps and I am usually waiting 200-400ms. It just feels too damn slow.&lt;p&gt;Why am I even typing this? This is the freaking whole point of an SPA. Are we not all caught up on this yet?</text></item></parent_chain><comment><author>chipotle_coyote</author><text>But the person you&amp;#x27;re replying to specifically cited SPAs, single page applications, as the use case for &amp;quot;download a big JS library first and then minimize future loads.&amp;quot; If the SPA presents more than five 5kb chunks of what you define as &amp;quot;actual pages of content&amp;quot; to the user in a single session -- which doesn&amp;#x27;t sound at all unreasonable -- then using your own numbers, the SPA is now slightly beating your web site (2600ms to 2700ms). By ten &amp;quot;pages,&amp;quot; the SPA has substantially pulled ahead (3400ms to 4500ms), and has still only sent 50kb of data past the initial huge hit. If the JS library is closer to the 2mb side than the 4mb side, it may well have already sent less data.&lt;p&gt;At any rate, the NYT page that Drew DeVault is complaining about isn&amp;#x27;t an SPA, and its problems don&amp;#x27;t stem from loading a JS library whose point is to make future requests faster. Its excessive JavaScript use is driven almost entirely by including advertising&amp;#x2F;marketing-driven code, and I would argue that JS is being a bit scapegoated here: it&amp;#x27;s a symptom, not the problem. I bet we could deliver a lean, mean, highly-optimized version of that web site that duplicated the exact same ads, down to the same obtrusive banner behavior. Would we like the site more then? Would any of us really respond, &amp;quot;Wow, it&amp;#x27;s &lt;i&gt;so much better&lt;/i&gt; now that I can be frustrated by this terrible design in a tenth the load time!&amp;quot;?</text></comment>
<story><title>Conservative web development</title><url>https://drewdevault.com/2018/09/04/Conservative-web-development.html</url></story><parent_chain><item><author>zelon88</author><text>Your math sounds wrong, so I did it on paper and proved that it&amp;#x27;s wrong.&lt;p&gt;The average bandwidth for a mobile device in the USA is about 3.25 mb&amp;#x2F;s (26mbps). So to load your &amp;quot;2-4mb&amp;quot; Javascript library you&amp;#x27;re looking at 400ms to connect + 1000ms to download resources. That&amp;#x27;s 1400ms.&lt;p&gt;Now for the rest of the math I benchmarked my own website. My homepage is ~300kb and loaded in 461ms. The fastest you&amp;#x27;re going to get ANYTHING back from my server is about ~170ms.&lt;p&gt;Lets start with your App. 1,400ms and the app is loaded. Load another page and it takes 200ms to load another 5kb of content. Load one more page and it&amp;#x27;s another 200ms for 5kb of content. I&amp;#x27;ve been waiting on your website for a total 1,800ms and viewed three &amp;quot;pages&amp;quot; of content.&lt;p&gt;Lets move on to my website. ~450ms and the site is loaded. Load another page and it takes another ~450ms to load another 300kb. Load another page and that&amp;#x27;s another ~450ms to load another 300kb. I&amp;#x27;ve been waiting on my website for a total of 1,350ms and viewed three actual pages of content, but the user only had to download 900kb instead of 4mb.&lt;p&gt;So I think you proved the OP&amp;#x27;s point.</text></item><item><author>coding123</author><text>There are two different kinds of web development:&lt;p&gt;a) Apps where the user is expected to stay a while&lt;p&gt;b) Sites where the user is there, maybe once ever (most likely also scared off by the ads)&lt;p&gt;For Apps, I would always prefer a pre-load of JS that was built with React and downloads about 2-4 MB. If there is an update I will be forced to download it again.&lt;p&gt;On the UPSHOT, almost everything I do in that app is now a 3-8KB request. This means transitioning pages, changing states of things, all happen in about 50ms including whatever visual changes are required on the screen.&lt;p&gt;Compare that to full-screen refresh apps and I am usually waiting 200-400ms. It just feels too damn slow.&lt;p&gt;Why am I even typing this? This is the freaking whole point of an SPA. Are we not all caught up on this yet?</text></item></parent_chain><comment><author>Izkata</author><text>Shouldn&amp;#x27;t your static assets be cached in the browser for pages 2 and 3, making your subsequent pages load a bit faster than the first?</text></comment>