Matsuuu / web-component-devtools

Web Component DevTools is a Browser Extension enhancing the development experience of Web Component developers
https://matsuuu.github.io/web-component-devtools/
MIT License
131 stars 3 forks source link

[BUG]: high cpu usage on pages with many tables on Firefox #58

Closed blikblum closed 1 year ago

blikblum commented 1 year ago

Describe the bug In a page with many tables ou one big table cpu usage is high. Tested on Firefox

To Reproduce Steps to reproduce the behavior:

  1. Go to a page with a table element with many rows
  2. Look at cpu usage

Expected behavior The extension should not lead to high cpu usage

Screenshots image

Desktop (please complete the following information):

Additional context The extension is walking in all elements with shadowRoot regardless of being custom elements or not, calling initDomMutationObservers (see the callstack (Pilha de chamadas) in screenshot)

Since there are many th, td elements this consumes a lot of time

One solution is to check if element is a custom-element in elementHasShadowRoot

Matsuuu commented 1 year ago

Heya @blikblum !

Thank you for the thorough report!

One solution is to check if element is a custom-element in elementHasShadowRoot

Yeah this part of the extension is something that hasn't got as much care as it should, and this is something that needs to be fixed.

I'll try to find some time within the next week to push a fix to this.

Matsuuu commented 1 year ago

Found some time to look at this and I think I found the reason for this happening and it should be fixed in the 0.2.1 update.

However... I notice you are using Firefox as your plugin platform an unfortunately they don't 100% support the Manifest v3 version of extension yet, so I am not able to update it just yet. I need to do some compatibility work with it to get it working on Firefox.

Until then, you can wait for the 0.2.1 version to ship for Chrome and use it through Google Chrome

Matsuuu commented 1 year ago

Let's close this one too and re-open if the problem exists after the 0.2.1 version update

blikblum commented 1 year ago

Many thanks. I will take a look