stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

Lazy-load extra network preview images

Open missionfloyd opened this issue 2 years ago • 16 comments

Moves the extra network previews to an <img> so native lazy-loading can be used. For those that need every lora.

Environment this was tested in

  • OS: Windows 10
  • Browser: Microsoft Edge

Screenshots or videos of your changes

https://user-images.githubusercontent.com/4073789/227837988-63bbbf4f-54e0-423e-a39b-118f048f909e.mp4

missionfloyd avatar Mar 27 '23 04:03 missionfloyd

To clarify, this makes it so that instead of all independent images being loaded at the same time by the browser when you open extra networks UI, only those that can be seen on screen are loaded, is that correct?

AUTOMATIC1111 avatar Mar 27 '23 05:03 AUTOMATIC1111

Yes

missionfloyd avatar Mar 27 '23 05:03 missionfloyd

So this must be unrelated to #8781 then because you can start seeing results very early even without <img>. Is there a way to measure/see usefulness of this?

AUTOMATIC1111 avatar Mar 27 '23 07:03 AUTOMATIC1111

Here's without it. All the images load at once, whereas with <img loading="lazy">, they load only when they're visible.

https://user-images.githubusercontent.com/4073789/227881483-8de93943-18a9-454e-a6b0-6386fb03db76.mp4

missionfloyd avatar Mar 27 '23 08:03 missionfloyd

No, I get that, but are there tangible advantages to loading them as you scroll? I personally for myself would prefer for everything to download right away, especially if otherwise you could get yet-uloaded images as you scroll.

AUTOMATIC1111 avatar Mar 27 '23 08:03 AUTOMATIC1111

In most cases not really, but according to #8781 it can be a problem when using it remotely and there are tons of them to load.

missionfloyd avatar Mar 27 '23 08:03 missionfloyd

In most cases not really, but according to #8781 it can be a problem when using it remotely and there are tons of them to load.

Anyway to do "all" locally and "lazy" remote?

FullBleed avatar Mar 27 '23 09:03 FullBleed

#8781 is about text of extension metadata I'm pretty sure.

AUTOMATIC1111 avatar Mar 27 '23 09:03 AUTOMATIC1111

Ah, okay. I'll remove it then.

missionfloyd avatar Mar 27 '23 09:03 missionfloyd

let's see i anyone else weighs in

AUTOMATIC1111 avatar Mar 27 '23 09:03 AUTOMATIC1111

i'd be in favor of lazy loading - with smaller number of previews, its no different, otherwise its beneficial. there are ways to do lazy loading progamatically just ahead-of-time (monitoring onscroll and current position), but that would be too much javascript for here.

vladmandic avatar Mar 27 '23 16:03 vladmandic

Fixes a lot of issues like #9055 and #9027 that completely freeze up all the settings components, seems like a very critical change

space-nuko avatar Mar 27 '23 22:03 space-nuko

@missionfloyd why did you close this?

papuSpartan avatar Apr 14 '23 12:04 papuSpartan

@missionfloyd why did you close this?

same question...

vladmandic avatar Apr 14 '23 12:04 vladmandic

I figured it's probably not that big a deal, but I'll reopen it.

missionfloyd avatar Apr 23 '23 01:04 missionfloyd

I'd still like to see this PR merged. For users with a ton of extra networks like myself, in the current state of the UI, just opening the panel invokes >2k requests and >2GB of images to be transferred. This is a huge no-no if you're running this remotely, and especially if you're attempting to access it from lower-powered devices such as mobile.

catboxanon avatar May 13 '23 00:05 catboxanon