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

refactor(ChunkScanner): use flow and skip empty sections #5174

Merged
merged 10 commits into from
Jan 7, 2025

Conversation

MukjepScarlet
Copy link
Contributor

It's now much better, especially for almost empty chunks in many minigames.

@1zun4 1zun4 requested a review from superblaubeere27 January 3, 2025 14:31
Copy link
Contributor

@superblaubeere27 superblaubeere27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this better than before?

@MukjepScarlet
Copy link
Contributor Author

MukjepScarlet commented Jan 4, 2025

  1. Skip the empty chunk sections, for example in superflat, only scan one or two is enough. What's more I don't know why some server chunks won't be considered as empty, even the scan procedure only consumes less than 10us now... We used to scan all of these chunks. In normal survival worlds the improvement will be minor.
  2. No need to reset the Channel(Queue), so we can remove the reset mutex. As we don't care the update order, all update events will be proceed concurrently in collect handler.
  3. I also reduced the amount of the scan job. It used to start a job for each y coord (one job=16x16), now it's by chunk section (one job=16x16x16), so fewer elements will be added to task queue of the dispatcher(executor). Now the scope has up to 1000 jobs in my test, and all of them will be finished in just one sec. The old implementation will have more than 10k jobs at world changes.

@1zun4 1zun4 added this to the 0.24.0 milestone Jan 4, 2025
@1zun4 1zun4 merged commit c9fa6e0 into CCBlueX:nextgen Jan 7, 2025
3 checks passed
@MukjepScarlet MukjepScarlet deleted the refactor/chunk_scanner branch January 7, 2025 18:32
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.

3 participants