-
-
Notifications
You must be signed in to change notification settings - Fork 625
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
Extremely high CPU usage with -w
#985
Comments
Hi @max-sixty, You mentioned you are using Can you let me know if you see the same issue on v3.20.0? |
This does still have the same issue with 3.20.0. Interestingly it only happens on
vs for
Is |
Came here because I have that problem too, it seems to scale pretty much with the files being watched (which made me aware of checking my pattern, turns out I watched a node_modules folder for js changes ... ). |
On this repository, with https://github.com/delaneyj/datastar Running templ:
env:
TEMPL_EXPERIMENT: rawgo
generates:
- "**/*_templ.go"
sources:
- "**/*.templ"
cmds:
- templ generate . Which matches a very reasonable number of files:
I see ~30% CPU usage on all 16 cores from If I modify that task to reduce the scope of the watch, such that: templ:
env:
TEMPL_EXPERIMENT: rawgo
generates:
- "backends/**/*_templ.go"
sources:
- "backends/**/*.templ"
cmds:
- templ generate . Which reduces the total candidate files considerably:
CPU usage drops to ~5-10% per core, which is... not great, but stops my fans from howling quite so vehemently at least. I suspect probably not much to be done about it until #1508 can happen (#1179 (comment)). |
Okay, weirdly, if the above
Simply by adding those second globs CPU usage jumps from 5-10% per core to 10-25% per core, even though the root directory contains very few files:
So there's definitely something wonky going on here. I don't use |
I have also observed high CPU usage when using watch. Here is my task: dev-go:
watch: true
cmds:
- go build -o tmp/main .
sources:
- "**/*.go" My CPU usage is about 35 % for all cores. I am using a Macbook Pro with the M2 10-core Apple Silicon CPU. When doing Strangely enough if I do the equivalent for my JS/TS files: dev-js:
watch: true
cmds:
- node build.mjs
- templ generate --notify-proxy
sources:
- "frontend/**/*.{ts,js}" I barely get any higher CPU usage at all (maybe 1-2% higher than just idling, and only activity on 1 core). The number of files are the same. EDIT: Ok after some more testing I observe that Task seem to iterate through all files in the my directory when doing my dev-go:
watch: true
cmds:
- go build -o tmp/main .
sources:
- "frontend/**/*.go" The quickest fix for me was to basically restructure my project such that I had to specify paths such that node_modules (and any other large dirs) were implicitly excluded, as the |
I'm running a task with
-w
and seeing extremely high CPU usage every few seconds. This is the Vitals chart:I thought it might be the underlying task, but I replaced the command with
echo hello
, and I'm seeing the same behavior. And the task is not re-running during this time (i.e. it's just waiting).If anyone would like to fully reproduce, it's here; and then
task -w test-rust
https://github.com/max-sixty/prql/tree/task-repro. Here's the link to the task to view it: https://github.com/max-sixty/prql/blob/701c4141441430f94932a780b32ce8de40b599d8/Taskfile.yml#L181-L208
I'd previously changed our docs to suggest
task
overwatchexec
, as that has some problems with ignoring files in PRQL/prql#1380. Zero stress if the repo is too big / doesn't work well with a large tree ascargo
though.The text was updated successfully, but these errors were encountered: