NicolasConstant / sengi

Mastodon & Pleroma Multi-account Desktop Client
https://nicolasconstant.github.io/sengi/
GNU Affero General Public License v3.0
534 stars 35 forks source link

Reduce search api usage #549

Open codl opened 1 year ago

codl commented 1 year ago

Follow up to #383 #384

I'd like to encourage you to look into that potential optimisation mentioned in https://github.com/NicolasConstant/sengi/issues/384#issuecomment-857325145

The search endpoint is not only slow but also expensive. On mastodon, when you search for the url of a post or account, your instance will hit the remote instance, not just the first time but every time. Meaning, every click on a status in sengi is a little bit of unnecessary federation traffic.

No, you can't reuse the IDs across instances, and the optimisation would only work when browsing things on one instance, but surely more time and requests are spent browsing on one instance than jumping across instances, no?

NicolasConstant commented 1 year ago

Yes, that's something that was transparent until last months, but with the Fediverse saturation it became a real issue.

The PR linked, as stated in the comments, would break all cross-instances functionalities, but surely a little optimization not doing it when interacting with a local account would help. The issue is this isn't a small modification and will require some work (in many areas I will have to share more than the URL to get proper context, and it's a pattern I have in a lot of the codebase). Maybe I'll find some bandwidth this year to tackle this.