zdharma-continuum / zinit

🌻 Flexible and fast ZSH plugin manager
MIT License
2.95k stars 126 forks source link

perf: decrease scheduler checks from every 1 second to 10 seconds #409

Closed psprint closed 1 year ago

psprint commented 1 year ago

Description

Change the time interval for the scheduler to check for queued tasks to ten seconds.

Motivation and Context

Lower system resource usage.

Related Issue(s)

362

How Has This Been Tested?

Types of change

Checklist:

psprint commented 1 year ago

I've updated the PR to check if there are any more tasks and schedule for 10s if not.

jankatins commented 1 year ago

Stupid question: is this running forever? If so: why? Can't it be stoped once all tasks have been run (and restarted, if there every comes in a new task)?

psprint commented 1 year ago

They run forever because it's ~5 lines of code every 1 second. That's very low overhead. More, if load'' and unload'' ices been passed, then the background schedule calls are needed to test them.

On Thu, 3 Nov 2022 at 11:30, Jan Katins @.***> wrote:

Stupid question: is this running forever? If so: why? Can't it be stoped once all tasks have been run (and restarted, if there every comes in a new task)?

— Reply to this email directly, view it on GitHub https://github.com/zdharma-continuum/zinit/pull/409#issuecomment-1301965993, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOE4CA6R4HMXK3Z7COM7C3WGOO4XANCNFSM6AAAAAARV57JGQ . You are receiving this because you authored the thread.Message ID: @.***>

-- Best regards, Sebastian Gniazdowski

psprint commented 1 year ago

I've added short-circuit return if no tasks, so basically it's 1 line of code every 10 seconds if no tasks.

vladdoster commented 1 year ago

This breaks the wait ice.

github-actions[bot] commented 1 year ago

:tada: This PR is included in version 3.9.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: