tvler / streetpass

Find your people on Mastodon
https://streetpass.social
MIT License
377 stars 7 forks source link

Very slow on large pages #63

Open fogti opened 8 months ago

fogti commented 8 months ago

When trying to access very large pages (e.g. huge GitHub diffs), this addon can slow down the page processing so much that Firefox warns about it, and the page feels extremely sluggy (and it spends like this for a long time, even on a system with a AMD Ryzen 5 7600X 6-Core Processor). It would be useful to either skip processing of pages which are too large, or exclude pages based upon user-definable URL regexes.

tvler commented 8 months ago

Thanks for bringing this up, that's super interesting. Streetpass uses a mutationobserver to detect dom changes to parse for verification links, and I kind of assumed that mutation observers were performant/off the main thread. Happy to go back to it and see if there's a less intensive detection system I can use

fogti commented 8 months ago

This occurs when opening "large diffs not previously rendered" sections, and the problem is that it doesn't appear to scale even nearly as well as the browser rendering itself, probably because the browser only renders stuff which is roughly on-screen, and skips everything not currently in view as much as possible... A fix could be skipping processing of very large pages or I suppose asking the user if they want to process the page instead of basically instantly hanging the page processing

tvler commented 8 months ago

after thinking about this for a day I think I have a way to do this in a more performant way without setting up a mutation observer -- will try fixing soon. thank you for bringing this up it was interesting to see that this DOM api isn't as fast as I thought it was!