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 usage of CPU #6

Closed
papoteur-mga opened this issue Jun 5, 2021 · 2 comments
Closed

High usage of CPU #6

papoteur-mga opened this issue Jun 5, 2021 · 2 comments

Comments

@papoteur-mga
Copy link

When executing nerd-dictation with or without --continuous option, the load of CPU is still high, of about one complete core.
When stopping the execution with keyboard interrupt, I got always interruption in function exit_fn.
If I try to add:

    time.sleep(PROGRESSIVE_CONTINUOUS_SLEEP_WHEN_IDLE)

just before calling return 0, the CPU usage is low, without big impact on accuracy.

@ideasman42
Copy link
Owner

ideasman42 commented Jun 5, 2021

This could be said to a default of PROGRESSIVE_CONTINUOUS_SLEEP_WHEN_IDLE, but it would be nice if it was tunable, personally I prefer some responsiveness at the cost of some CPU time, although it's possible a 10th of a second avoids too much cpu usage without a noticeable difference.

ideasman42 added a commit that referenced this issue Jun 25, 2021
Add `--idle-time` argument, to prevent high CPU usage while recording.

The default is 0.1 seconds (reading data 10 times a second).

Reading & processing small amounts of data at a time doesn't have an
especially big advantage compared with the cost of high CPU usage.
@papoteur-mga
Copy link
Author

Great fix, thanks. :-)

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