fraidycat icon indicating copy to clipboard operation
fraidycat copied to clipboard

Performance / cpu / power usage

Open hiisukun opened this issue 6 years ago • 8 comments

Desktop (please complete the following information):

  • OS: Linux
  • Browser: Firefox
  • Version: 71.0

Describe the bug I installed your extension recently due to attention on hackernews and thought it was excellent. Unfortunately, due to performance issues I uninstalled.

I was following two youtube accounts weekly, and three online rss pages (with only a few posts generally per week) in 'real-time'. My laptop was getting warm, and I noticed Firefox (71.0) was using a lot of CPU. In about:performance Fraidycat was 90-110 (listed as 'high' energy impact) with ~2.2MB of memory used.

I changed the 'real-time' to 'daily' for those three sites, expecting things to change, but the performance was the same. When I uninstalled the addon, Firefox CPU went back down immediately.

Not sure what other debug info to provide - but I'm happy to re-install if necessary to collect some. I don't check github often though - apologies!

I searched existing open issues for 'cpu' and 'performance', and didn't see anything. But if there is something related to other bugs, feel free to merge this with some other issues.

hiisukun avatar Dec 21 '19 06:12 hiisukun

Ok good - thank you for this! In my playing around with this, I've made quite a bit of improvement already. (I confess that I'd forgotten the details behind JavaScript's setInterval.) I am updating the extension on Monday, so I hope you will check back then to see if my progress is adequate.

kickscondor avatar Dec 21 '19 19:12 kickscondor

Further progress on this - I've located the primary source of trouble. For some strange reason, if I save data to storage.sync in the web extension and I'm monitoring it as well with an onSync listener, that same data will come right back to the extension. This can cause an infinite loop of sending/receiving if the data isn't perfect. (In this case, a bug in the deletion sync was also aggravating this!)

There are fixes now in df3d494. The onSync now works to discard messages sent by itself. The deletion bug is fixed. And I also did some work to move away from setInterval and provide some progress to the main window.

I still hope to get enough testing in so I can have this in everyone's hands by tomorrow.

kickscondor avatar Dec 22 '19 20:12 kickscondor

Well that sounds like excellent progress. I'll keep an eye on this and happily test the changes when you merge them : )

hiisukun avatar Dec 23 '19 06:12 hiisukun

Okay, this is out for Firefox. You can reinstall from mozilla.org. I am going to keep this issue open for now, as a reminder to stay vigilant.

kickscondor avatar Dec 23 '19 08:12 kickscondor

Been running the extension this morning for a while, with the same 5 entries. The measure in about:performance is betwen 0.1 and 0.25 (both 'low'), and my old laptop is very happy.

Wonderful!

hiisukun avatar Dec 23 '19 22:12 hiisukun

Sweet! Thank you for returning to check it out. I have some ideas for reducing this to zero - but it will take a few months to get there.

kickscondor avatar Dec 24 '19 00:12 kickscondor

Ok - for some reason memory use has climbed recently. It's strange because the JS memory footprint looks fine in the background window (10-15 MB) - but the browser task manager shows much much higher memory usage (100-200 MB). Electron app similarly seems to skyrocket.

kickscondor avatar Apr 08 '20 16:04 kickscondor

It looks like I have a good lead on this issue! The Web API DOMParser class appears to hang on to old HTML documents after they've been parsed. https://stackoverflow.com/questions/56451731/dom-parser-chrome-extension-memory-leak

kickscondor avatar Apr 17 '20 14:04 kickscondor