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

High CPU usage #268

Open
Germano0 opened this issue Sep 19, 2022 · 14 comments
Open

High CPU usage #268

Germano0 opened this issue Sep 19, 2022 · 14 comments

Comments

@Germano0
Copy link

When Firefox 104 is using a lot of CPU and you open about:performance, you will often find out that the reason is LeechBlock NG 1.5.1

@proginosko
Copy link
Owner

Do you have a lot of tabs open?

@peitl
Copy link

peitl commented Sep 22, 2022

I can confirm I have the same issue, and yes, I do have a lot of tabs open.

@proginosko
Copy link
Owner

Select the option "Process only active tabs" under General options and see if that helps.

@Germano0
Copy link
Author

I selected Process only active tabs, restarted Firefox, but the CPU usage is still high. Yes I have many tabs, but for example UBlock Origin is not suffering from the high amount of opened tabs
immagine

@proginosko
Copy link
Owner

Please export your options to a file and email it to [email protected] so I can investigate further.

@peitl
Copy link

peitl commented Sep 28, 2022

For the record, I selected Process only active tabs and it seems to have fixed the issue. I still wonder though, where the issue was coming from in the first place. I thought LeechBlock was only in operation when a new page is being loaded, is that not so?

@proginosko
Copy link
Owner

No, LB regularly checks tabs in case the blocking conditions have been met since the page originally loaded (e.g., the time limit has been reached, or a page with dynamic content has introduced a keyword that should trigger a block). This is necessary to support the "Immediately block pages on these sites once blocking conditions are met" option.

@peitl
Copy link

peitl commented Sep 29, 2022

Fair enough, but if that option is off (as it is in my case), then LB should only activate when a new page is being loaded, shouldn't it?

@proginosko
Copy link
Owner

Sorry, I should have added that LB regularly checks tabs also to keep track of the amount of time spent on sites. That will happen regardless of the "Immediately block" setting. If you've selected "Process only active tabs" you shouldn't have high CPU usage though. Do you have a very long block list?

@peitl
Copy link

peitl commented Sep 30, 2022

No, I'm blocking around 20 domains in total. I also don't have any rules set up to block pages after a certain amount of time. I don't have a high CPU usage all the time now (having ticked "Process only active tabs"), but there are still CPU usage spikes from LB every now and then.

Even if LB has to regularly check a large number of tabs for time spent, I don't see how that should make it use a lot of CPU, that is not a complicated operation, is it? It's not like I have millions of tabs.

@mtmkls
Copy link

mtmkls commented Jan 20, 2023

Sorry, I should have added that LB regularly checks tabs also to keep track of the amount of time spent on sites. That will happen regardless of the "Immediately block" setting. If you've selected "Process only active tabs" you shouldn't have high CPU usage though. Do you have a very long block list?

Why does LB keep track of the amount of time when I have not set time limits? Why does LB keep track of the amount of time on all (active) tabs instead of just the focused one?

@proginosko
Copy link
Owner

Why does LB keep track of the amount of time when I have not set time limits?

(1) For the Statistics page. (2) In case a time limit is added on the fly.

Keeping track of the time is not itself CPU intensive. Even without a time limit for a block set, the processing would be much the same.

Why does LB keep track of the amount of time on all (active) tabs instead of just the focused one?

"Active tab" just means the focused tab in this context.

@mtmkls
Copy link

mtmkls commented Feb 13, 2023

Keeping track of the time is not itself CPU intensive.

Okay, then why is this extension by far the highest energy impact in the firefox task manager constantly?

@proginosko
Copy link
Owner

In your case, I don't know (yet). You make it sound like this is an issue for all users, but as far as I can tell, it's only an issue for a small number of users. If you want to help, you could do some diagnostics to narrow down the cause. Disable all but one of the block sets (see option to disable under Advanced Options) and see if the CPU impact is still high. Repeat for the other (used) block sets. See if the issue can be traced to one particular block set, and if so, we can take a closer look.

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

4 participants