Hazel CPU usage, best practices advice

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Hazel CPU usage, best practices advice Mon Dec 09, 2019 8:31 pm • by gcoghill
I am assuming the best way to determine what Hazel is doing that causes high CPU usage would be the suggestions in other forum threads — highlight the hazelworker item in Activity Monitor, then Sample Processes.

I'm trying to wrap my head around the best way to set up rules. I suspect that my occasional high CPU might be due to poorly-configured Hazel rules and folders.

I saw Mr. Noodle suggest in other threads that if you want to monitor multiple subfolders in one folder, it's better to set up rules for the folder that contains them all, rather than add separate rule sets for each folder.

I used to do the latter.

I've set things up which I think is more ideal, where I have Hazel monitor just the main folder (say "Documents"), and use the "run rules on folder contents" actions only act upon specific folders within (using a rule such as "enclosing folder is named XYZ").

But then I got to thinking that maybe Hazel will need to scan ALL the folders/items in Documents to determine if anything in them has changed. What is the preferred approach here?

Also, are there any generally good practices for rules as far as minimizing Hazel CPU usage? I try to use rules such as "Date Last Modified is after Date Last Matched", but also wondered if that was forcing Hazel to scan every single file in all the subfolders to determine this.
gcoghill
 
Posts: 290
Joined: Tue Sep 18, 2007 8:09 am
Location: Kent, OH

Re: Hazel CPU usage, best practices advice Tue Dec 10, 2019 11:28 am • by Mr_Noodle
If you have your "Run rules on folder contents" rule filter out folders it doesn't need to go into, then those subfolders, in general, shouldn't come into play. If you are actually experiencing high CPU, send in the process samples but until then, I wouldn't worry too much about it.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Hazel CPU usage, best practices advice Tue Dec 10, 2019 1:21 pm • by gcoghill
Some of my "run rules on folder contents" criteria include whether or not the items within have changed.

Since the wording of the rules is "any of it's subfiles or subfolders", that caught my attention as maybe being an issue — does the "any" imply all nested folders, or just the files/folders directly in the folder specified by the rule?

But as I type this, even if that is the case, I realize I can likely add a Subfolder Depth criteria to limit how deep that applies — correct?

I will say that I have seen less CPU usage now that I have consolidated my folders and rules to "cascade". Could just be that I fixed some rule logic inefficiencies (checking way too many files/folders) and less to do with the multiple folder approach for rules which I migrated away from.

It's not always convenient to keep organized, especially when a specific folder has multiple criteria to match and there are multiple folders like that under one main folder.

My CPU issues were intermittent, which to me indicated a rule set that was inefficient. I think my recent folder/rule cleanup may have solved those issues.
gcoghill
 
Posts: 290
Joined: Tue Sep 18, 2007 8:09 am
Location: Kent, OH

Re: Hazel CPU usage, best practices advice Wed Dec 11, 2019 11:48 am • by Mr_Noodle
You can specify subfolder level as long as it's under the nested condition.

If rules on subfolders are pretty unique to each subfolder, then it might make more sense to separate those out and monitor those folders separately.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support