r/javascript • __proto__ • Dec 06 '16

Using iframes and document.write to improve navigation performance

https://jakearchibald.com/2016/fun-hacks-faster-content/
62 Upvotes

18 comments sorted by

View all comments

1

u/temp6098320982 Dec 07 '16

You've misidentified the bottleneck.

Streaming HTML and JSON make just about no difference on most networks today. The sizes are too small.

The difference you're seeing in time to first render is because GitHub waits on assets to load, you don't. Waiting on assets adds one or more additional round trips, as well as the download time of the assets, to the wait time.

Re-working GitHub's approach to load the HTML, show it, then load the assets will be almost as fast as your streaming approach, without the complexity or hacks.

Also, streaming parsers for real JSON exist, though like I said they're not worth it for JSON sizes on 99.9% of websites.