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

Use all cpus for intensive tasks #381

Merged
merged 3 commits into from
Dec 7, 2024
Merged

Conversation

kralverde
Copy link
Contributor

Description

cd6ac14 introduced a regression where CPU intensive tasks are not performed by all CPUs. This is because the rayon pool does not queue tasks until the current task is complete and because the tokio runtime never ends we effectively lose a CPU.

Additionally, the root cause of the tokio runtime choking is because we were waiting for the results of the rayon pool directly from the tokio runtime, blocking it, which obviously defeats the purpose.

This PR fixes these issues, sorts initial spawn chunks so that rayon processes them in rings rather than slices, and adds a note in CONTRIBUTING.md on how to avoid issues like this in the future.

Testing

Joined the server in debug mode and ran commands while chunks loaded

Checklist

Things need to be done before this Pull Request can be merged.

  • Code is well-formatted and adheres to project style guidelines: cargo fmt
  • Code does not produce any clippy warnings: cargo clippy
  • All unit tests pass: cargo test

@Snowiiii
Copy link
Member

Snowiiii commented Dec 7, 2024

LGTM.
Thanks @kralverde

@Snowiiii Snowiiii merged commit ed29346 into Pumpkin-MC:master Dec 7, 2024
9 checks passed
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