kickscondor / fraidycat

Follow blogs, wikis, YouTube channels, as well as accounts on Twitter, Instagram, etc. from a single page.
Other
1.76k stars 56 forks source link

Performance / cpu / power usage #54

Open hiisukun opened 4 years ago

hiisukun commented 4 years ago

Desktop (please complete the following information):

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.

kickscondor commented 4 years ago

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 commented 4 years ago

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.

hiisukun commented 4 years ago

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

kickscondor commented 4 years ago

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.

hiisukun commented 4 years ago

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!

kickscondor commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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