soscripted / sox

Stack Overflow Extras: a userscript for the Stack Exchange websites to add a bunch of optional toggle-able features
http://stackapps.com/q/6091/
MIT License
72 stars 15 forks source link

Optimise SOX #391

Closed shu8 closed 5 years ago

shu8 commented 5 years ago

SOX can sometimes add up to a few seconds to page load times, and its performance seems to decrease as more features are enabled.

This causes users to have to think about which features they want most rather than enabling all that they like.

Whilst SOX inevitably will cause some increase in load times due to the changes/insertions it does to the DOM, I'm confident it can be improved.

I logged some very quick timing data on the time it takes from the first feature to load till the last using the features I have enabled (I have 50 out of the current 79 available enabled):

They seem to range from 200ms to 500ms. I'm not entirely sure how they're so different but it would be great to reduce this!

Some ideas on what I'm planning to do at first:

If anyone has any other ideas, please do comment here, or submit a pull request!

shu8 commented 5 years ago

With these changes, I've seen times go down to ones along these lines:

I'm fairly sure I'm using the same SE page I used to get the original numbers in this issue, and it definitely does seem to have improved.

Whilst there may (will!) be more improvements to be made, I've finished the main things I wanted to do (cache API responses, improve MutationObservers), so I'm going to close this and release v2.5.0 to master.