Closed mnowotnik closed 2 years ago
Sure, go ahead.
@romkatv I didn't mean to be rude. I just wanted to know what are the benefits of using this tool over sched :)
They are different tools.
@romkatv They seem pretty similar to me
Check the docs of both tools.
Sure.
Differences:
Similarities:
Moreover, in the zsh-defer README, it's written:
zsh-defer defers execution of a zsh command until zsh has nothing else to do and is waiting for user input. Its intended purpose is staged zsh startup. It works similarly to Turbo mode in zini
..and the reason Turbo mode works in zinit is that zinit-scheduler is being run periodically by sched
- zsh-defer can't print to stdout
This is incorrect.
Similarities:
- both execute commands when a shell is waiting for a user input
sched can execute commands from precmd or zle, while zsh-defer executes all commands from zle. This makes sched unusable for the primary use case of zsh-defer.
To sum up, sched and zsh-defer are different tools. Their differences are in their respective documentations.
Alright, thanks for clarification regarding precmd. That's what I was missing.
This makes sched unusable for the primary use case of zsh-defer.
Well, it's good enough for zinit to use and I don't feel any delays while using zinit, but of course only a proper benchmark would tell the difference.
This makes sched unusable for the primary use case of zsh-defer.
Well, it's good enough for zinit to use and I don't feel any delays while using zinit, but of course only a proper benchmark would tell the difference.
zinit turbo mode != shed. zinit turbo mode uses sched but it also uses for loops. Clearly for loop != zinit turbo mode.
Yeah, you're right. Only scheduler runs this way. The part that executes tasks is run as a handler for an fd.
This might prove useful if you haven't seen it yet: https://github.com/romkatv/zsh-bench#deferred-initialization
That's informative. Thanks!
Why not just use sched command from the zsh/sched module?