ts-liveview icon indicating copy to clipboard operation
ts-liveview copied to clipboard

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

Open hpvd opened this issue 3 years ago • 2 comments

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

  • speeding up the time till a website
    • looks ready (above the fold ) or
    • is ready (fully interactive)
  • tuning speed without having to use inlining of js or css which is
    • bad from security POV, see https://github.com/beenotung/ts-liveview/issues/8#issuecomment-1144940188
    • bad for effective browser caching
    • suboptimal for deploy and deliver (minifying and compressing)

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 avatar Aug 08 '22 19:08 hpvd

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

hpvd avatar Aug 08 '22 19:08 hpvd

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?

beenotung avatar May 10 '23 03:05 beenotung