mastodon icon indicating copy to clipboard operation
mastodon copied to clipboard

Mastodon v4.0.0 web UI loads several MB in resources

Open nemobis opened this issue 3 years ago • 4 comments

Steps to reproduce the problem

  1. Open any user profile like https://mastodon.online/@pkrugman while logged out ...

Expected behaviour

The page should finish loading within a reasonable time

Actual behaviour

The page is busy downloading resources for multiple seconds

Detailed description

Loading a simple profile, almost empty, takes about 6 MB of download on Mastodon v4.0.0., while performance for the same profile on Nitter is vastly better at just 1 MB of data needed.

Compare:

At least on mastodon.online, this seems to be partly due to a single 4 MB image, https://mastodon.online/emoji/sheet_13.png

The same issue is observed on other instances like mas.to. nitter.it Firefox...urt, Germany - EC2 - WebPageTest Result.pdf.gz mastodon.online F...urt, Germany - EC2 - WebPageTest Result.pdf.gz mas.to Firefox -...furt, Germany - EC2 - WebPageTest Result.pdf.gz

Specifications

Mastodon 4.0.0.rc2 Firefox 106

nemobis avatar Nov 10 '22 15:11 nemobis

https://mastodon.online/emoji/sheet_13.png shouldn't be loaded if logged out. I noticed some weirdness when I was testing the same thing earlier tonight, where the emoji sheet was loading while logged out, if I was using Chrome that had been logged in, but only sometimes (possibly only when I ran Lighthouse, it was hard to be sure).

ineffyble avatar Nov 10 '22 15:11 ineffyble

The fact you're getting remote tests showing the file means it's not some weird local issue with service workers like I suspected. Very odd.

ineffyble avatar Nov 10 '22 15:11 ineffyble

After some investigation, the file is added to the manifest in config/webpack/production.js and preloaded by the service worker, so that the emoji sheet is loaded by the time the user clicks on the emoji picker.

However, when logged out, the emoji picker would never show up, and loading that file is useless. I also wonder if it makes sense to install the service worker at all when logged out.

ClearlyClaire avatar Nov 10 '22 16:11 ClearlyClaire

Things got a bit better, with the FCT (first contentful paint) now at about 1.7 seconds instead of 2, and 2.4 MB downloaded instead of 6. mastodon.online F...urt, Germany - EC2 - WebPageTest Result.json.gz mastodon.online F...urt, Germany - EC2 - WebPageTest Result.pdf.gz

Still a long way to go before we can match Nitter.

nemobis avatar Jun 01 '23 06:06 nemobis