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

perf: unify startWorker and worker to spawn less goroutines #59

Merged
merged 2 commits into from
Aug 12, 2022

Conversation

Wondertan
Copy link
Contributor

This PR is more like a question, more than a fix, as I think worker and startWorker are in split for a reason, which I just probably don't get. Can you pls explain it? I couldn't find the answer in git history and out of curiosity.

If there is no reason for that, then this PR should decrease the load on the runtime by spawning fewer routines in general and one less per worker in particular. Thanks for the great library anyway.

@Wondertan
Copy link
Contributor Author

Kind ping @gammazero

@gammazero
Copy link
Owner

gammazero commented Aug 12, 2022

When starting a new worker, I want that new worker to run the new task directly, instead of pulling it off the work queue. Since the behavior was slightly different, I split it into two functions. Other than that, there is no reason it cannot be the same function.

@gammazero gammazero merged commit c38099e into gammazero:master Aug 12, 2022
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

Successfully merging this pull request may close these issues.

2 participants