I have a chrome extension that is causing user's laptops to slow to a crawl and realllllly use a lot of CPU (or at least causes their fan to go nuts).
I'm wondering how I can profile this, or see what's going on.
Some theories to help guide:
- extension needs (unfortunately) to do some polling. I won't go into why this is the case, but trust me that it does.
What this ends up looking like, however, is:
setTimeout(function() {
// our inner scrolling loop
scrollingTimerId = setInterval(function() {
// did the user change the URL?
if (!isModalUrl(window.location.href)) {
clearInterval(scrollingTimerId);
}
// scroll!
doScroll();
}, SCROLL_DELAY);
// our loop to check if we're done
isDoneTimerId = setInterval(function() {
...
}, OTHER_DELAY);
}, TIMEOUT_DELAY);
Perhaps there is some failture to cancel setInterval
or something that's causing the usage to increase over time?
- extension also sends messages to ALL tabs on certain events. Could this be an issue with multiple Chrome windows open?
Trying to hunt down what performance issues it could be, and also where to look. Perhaps there is a good tool I don't know about in the Chrome dev tools inspector?