Deadname-Remover: v2 causes severe lag spikes on pages with lots of DOM element manipulation/changes

Easiest reproduction of this is opening a GitHub PR that changes several tens of thousands of lines of code. I first noticed this on https://github.com/serenity-rs/serenity/pull/3056/files (although it’s been rebased since so takes much less time but it’s still noticeable). While poking through this repo for source code I also noticed a hang while clicking into https://github.com/arimgibson/Deadname-Remover/blob/main/entrypoints/options/App.svelte

Firefox hangs for 10-15 seconds for me on a i7-13700K so I can imagine it’s much worse on lower end machines. A profiling session shows acceptNode and children being the majority of this CPU time.

Image

While there might’ve been similar lag spikes in v1 I certainly didn’t notice them to this degree, and they weren’t bothering me at all. It seems like v2 recurses down the entire DOM tree thanks to MutationObserver and then recurses back up for each element to see if any parent is a form element and I’d be willing to bet this is the majority of the CPU time here. Caching this would help a lot but this feature in general seems like it’ll hurt performance a lot although I can’t really think of any other way to add it.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Nevermind replicated regardless of the settings bug. Thanks for the report; will start figuring out how to resolve!

@tazz4843 @sudo-nano this is now live! Make sure your extensions update to v2.0.2, and lmk if anything else comes up! Appreciate the submission 😊

Starting development on the bug fix for this now – also not quite sure yet how I’m going to approach but appreciate the caching suggestion!

Same issue here, reproduced by accessing tumblr.