beenotung / ts-liveview

Build hybrid SSG and SSR realtime SPA/MPA with Typescript
https://liveviews.cc
BSD 2-Clause "Simplified" License
168 stars 2 forks source link

Further speed up load time and don't slow down because of security #14

Open hpvd opened 2 years ago

hpvd commented 2 years ago

With http/2 and http/3 server push of resources to load them earlier, one could do 2 things

Sadly, server push is dead since chrome removes support because only to few websites makes use of it... https://groups.google.com/a/chromium.org/g/blink-dev/c/K3rYLvmQUBY/m/vOWBKZGoAQAJ?pli=1

But there is another alternative: giving a preload hint for needed resources https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/preload

browser coverage is 94.75% for Resource Hints: preload https://caniuse.com/?search=preload

hpvd commented 2 years ago

as first, pretty easy step: would be interesting to see if there is a difference noticeable if one give a preload hint to the main script: https://liveviews.cc/js/bundle.min.js

e.g. current status of https://liveviews.cc/editor 2022-08-08_14h40_09

beenotung commented 1 year ago

In the current version, the bundle script is placed before the main content, and given a "defer" attribute. This setup should allow the browser to fetch the script early without blocking the DOM parsing.

So using preload link should be making no difference?