Support Native Lazy-Loading #2198

Closed
tae wants to merge 1 commit from gitlab-mr-iid-931 into develop
Member

According to the release announcement, starting with Chrome 76, we'll be able to use the new loading attribute to lazy-load resources without the need to write custom lazy-loading code or use a separate JavaScript library. We can now lazy-load images without

  • Using any external library,
  • Writing custom lazy-loading codes or
  • Loading JavaScript on the Frontend

NOTE: This works only in Chrome atm. The other browsers will just ignore this.

ref: https://scotch.io/bar-talk/native-lazy-loading-launched-on-chrome-76

According to the release announcement, starting with Chrome 76, we'll be able to use the new `loading` attribute to lazy-load resources without the need to write custom lazy-loading code or use a separate JavaScript library. We can now lazy-load images without - Using any external library, - Writing custom lazy-loading codes or - Loading JavaScript on the Frontend **NOTE:** This works only in Chrome atm. The other browsers will just ignore this. ref: https://scotch.io/bar-talk/native-lazy-loading-launched-on-chrome-76
Member

not a big fan of supporting browser-exclusive stuff, but sure. Just need to test it first.

not a big fan of supporting browser-exclusive stuff, but sure. Just need to test it first.
Member

it's still free

more on topic: I still don't get what the big difference is in lazy loading for us, we don't tend to load that many statuses with visible attachments, the biggest save comes when you decide not to scroll to see all the posts you loaded and only view half of them. it's a pretty much useless save compared to the downside of visible pop-in all the time everywhere :/

it's still free more on topic: I still don't get what the big difference is in lazy loading for us, we don't tend to load that many statuses with visible attachments, the biggest save comes when you decide not to scroll to see all the posts you loaded and only view half of them. it's a pretty much useless save compared to the downside of visible pop-in all the time everywhere :/
Owner

Yeah I'd like to see some benchmarks and a deeper dive into this. Biggest win, really, is on mobileFE where you can get crushed just by loading a timeline on a slow-ish mobile connection. Or how about when you load someone's profile and in the background it fetches the media tab and then is downloading images in the background (right? it seems to be doing this for me, but i haven't verified)

Yeah I'd like to see some benchmarks and a deeper dive into this. Biggest win, really, is on mobileFE where you can get crushed just by loading a timeline on a slow-ish mobile connection. Or how about when you load someone's profile and in the background it fetches the media tab and then is downloading images in the background (right? it seems to be doing this for me, but i haven't verified)
Member

While opening a profile it does load the statuses in all the timelines, but I don't think the images get downloaded before the statuses are being rendered. Gotta test it out a bit. I guess the benefit comes from better ordering the download order, with lazy loading it always loads stuff in viewport and not all at once, even if in the end it does download everything as you scroll downa bit.

While opening a profile it does load the statuses in all the timelines, but I don't think the images get downloaded before the statuses are being rendered. Gotta test it out a bit. I guess the benefit comes from better ordering the download order, with lazy loading it always loads stuff in viewport and not all at once, even if in the end it does download everything as you scroll downa bit.
Member

IIRC browser does not fetch images that are not visible, unless of course it's some retarded "browser" like safari

IIRC browser does **not** fetch images that are not visible, unless of course it's some retarded "browser" like safari
Member

I tested this on Chrome 78 and did not notice any notable memory or CPU use difference. Do we really need this?

I tested this on Chrome 78 and did not notice any notable memory or CPU use difference. Do we really need this?
Owner

we might lose all benefits of this with garbage collection anyway

we might lose all benefits of this with garbage collection anyway
Member

i don't think those two are related in any way

i don't think those two are related in any way
Owner

Gonna kill this effort for now.

Gonna kill this effort for now.

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
pleroma/pleroma-fe!2198
No description provided.