Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use non-persistent background page #88

Closed
bershanskiy opened this issue Aug 7, 2019 · 3 comments
Closed

Use non-persistent background page #88

bershanskiy opened this issue Aug 7, 2019 · 3 comments

Comments

@bershanskiy
Copy link
Contributor

The persistent background page is loaded persistently, so even when there are no events to handle and even no YouTube videos (tabs or embedded frames) are open. This is wasteful since most of the time user does not watch videos let alone constantly actively interact with the server.

How to do it.

I think this refactoring might simplify #87.

@ajayyy
Copy link
Owner

ajayyy commented Aug 7, 2019

Right now the background script just waits for messages from the content script, so this should not be hard to implement. Good idea!

@bershanskiy
Copy link
Contributor Author

Since the PR was merged, I'll close this issue now.

@ajayyy FYI: The non-background script did reduce memory usage on my system somewhat, but extension still listens on all tab changes so still consumes resources when there are no YouTube videos open (on the main site or embedded). I still see the actual background process in the task manager often even when I do not have YouTube and do not have embedded videos. For me, the stack size fell from 3-4 MB to 2-3MB and overall process memory from 28MB to 19MB.
This happens because you still have an chrome.tabs.onActivated event listener that gets called each time any tab gets activated, so browser evicts the process from memory only if you do not do any tab changes and navigations within the same tab. The should be resolved when this event listener is removed.

@ajayyy
Copy link
Owner

ajayyy commented Aug 11, 2019

Thanks for the update and PR! 10 mb is a pretty good reduction in ram.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants