awesome-uses icon indicating copy to clipboard operation
awesome-uses copied to clipboard

As people are added, the site is becoming sluggish and slow to load

Open transiient opened this issue 4 years ago • 10 comments

Not sure what could be done about this but I've just noticed it. With the amount of people who are in the list now, the website loads up quite slowly.

Could lazy-loading be implemented somehow?

transiient avatar Jan 30 '20 19:01 transiient

How is it slow? Scrolling? Images loading? rendering?

wesbos avatar Jan 30 '20 19:01 wesbos

Using Firefox, these are the network stats I got:

262 requests
3.86 MB / 1.99 MB transferred
Finish: 11.96 s
DOMContentLoaded: 4.97 s
load: 11.53 s

A lot of the request were avatar URLs - these could possibly be minimised by only loading when they're in the viewport.

Filtering is also extremely slow for me but that could be due to my system (dual core i3).

transiient avatar Jan 30 '20 19:01 transiient

Yeah almost all of that is image requests. I'll add lazy loading, looks like it will be added to firefox soon so its a good solution.

Filtering does have a few MS of lag for me too. Likely in the React render. Anyone want to take a look at this?

wesbos avatar Jan 30 '20 20:01 wesbos

https://github.com/wesbos/awesome-uses/commit/ee7be1dcdf2f436da4bc34a51e78a4b7bd31ebf7

wesbos avatar Jan 30 '20 20:01 wesbos

You can tell the lag is in the render because when we filter for small numbers, it's fast.

I bet we can just hide people instead of re-rendering each time. Let me try that..

wesbos avatar Jan 30 '20 20:01 wesbos

I goofed around with it for a bit yesterday but I don't think hiding it is the issue..

If anyone is good ith the profiler on react dev tools, please take a look. It very clearly shows that the render for the large tags( 150+ people) takes ~300ms which is way too long

wesbos avatar Jan 31 '20 17:01 wesbos

Notes:

  • https://reactjs.org/docs/optimizing-performance.html#virtualize-long-lists

iamandrewluca avatar Feb 11 '20 23:02 iamandrewluca

This, from your link, looks incredibly promising, and I don't see it being too difficult to implement. Seems like it'll just take a few lines. I'll play around.

transiient avatar Feb 12 '20 19:02 transiient

Or maybe infinite pagination can be added. https://www.gatsbyjs.org/docs/adding-pagination/

iamandrewluca avatar Feb 14 '20 10:02 iamandrewluca

I think the easiest (potential) fix would be to apply content-visibility and contain-intrinsic-size in CSS, so only the visible parts are rendered by the browser: https://web.dev/content-visibility/

jonaskuske avatar Feb 24 '21 10:02 jonaskuske