Remix.run Logo
▲ rileymat2 14 hours ago

I am not following the logic.

Say I write a static html page that loads a series of images down the page where one image will fit on your screen at any time. If the browser loads them all into memory at once without releasing the memory or maintains the a fully rendered virtual page out of sight, is that bloat the app or runtime fault?

▲8n4vidtmkvmk 14 hours ago | parent | next [-]

Both.

Runtime can certainly be optimized, but the app can also virtualize or force unloading if it needs to.

▲rileymat2 2 hours ago | parent [-]

I am just talking about a page that is something like a descriptive document for the browser to deal with, probably less than 500 bytes.

     <html>
     <body>
     <img...>
     <br>
     <img..>
      ...
      </body>
     </html>
▲mkgiga 13 hours ago | parent | prev | next [-]

It's a difficult question because there are so many factors in dom/css that change the answer to 'is there a chance that the image should be rendered the next frame?' that it becomes really hard to implement a strategy for what content to offload to disk and when

If the runtime fails to load the offloaded data back in time there will be visible rendering artifacts so you really have to make sure your strategy is robust

▲imp0cat 12 hours ago | parent | prev [-]

If the static page is badly written and does not instruct the browser to use lazy loading (using the loading="lazy" attribute on the img tag) and the browser loads them all at the same time, is that a problem with the page or the browser?

▲KronisLV 8 hours ago | parent [-]

The whole ecosystem.

Lazy loading for images was only introduced around 2019, not every website out there will have been updated since (and retroactively become “badly written”).

It is also not on by default, because the platform itself is too conservative and the implementation doesn’t allow zero breakage changes of defaults like that.

The tooling culture around HTML also isn’t such that you’d be prevented from deploying a site if you can use it but don’t, at least you’re not railroaded towards that.

Lazy should have been the implicit default and we should have gotten loading=“eager” instead. Same with having sane calendar controls, dropdown and collapsible controls, video controls so good we wouldn’t need vendor equivalents, light boxes for images and so on.