Skip to content

Cleanup optimize mob spawning#658

Merged
Dreeam-qwq merged 11 commits intover/1.21.11from
chore/optimize-mob-spawning-cleanup
Mar 9, 2026
Merged

Cleanup optimize mob spawning#658
Dreeam-qwq merged 11 commits intover/1.21.11from
chore/optimize-mob-spawning-cleanup

Conversation

@Dreeam-qwq
Copy link
Copy Markdown
Member

@Dreeam-qwq Dreeam-qwq commented Mar 1, 2026

  • Extracted per player mob count update
  • Moved modified NaturalSpawner methods together
  • Merged NatureSpawnChunkMap#collectSpawningChunks into collectSpawningChunks#build, since only one call
  • Optimized mob spawning's async executor
  • Ported counter fix
  • Added test for pufferfish's async executor
  • Code format, cleanup & complete comments
  • Other changes please check commits

- Extract per player mob count update
- Move modified NaturalSpawner methods together
- Merge `NatureSpawnChunkMap#collectSpawningChunks` into `collectSpawningChunks#build`, since only one call
- Code format & complete comments
@Dreeam-qwq Dreeam-qwq requested a review from hayanesuru March 1, 2026 12:25
@Dreeam-qwq Dreeam-qwq added the type: general Pull request for general updates / changes label Mar 1, 2026
hayanesuru and others added 4 commits March 4, 2026 18:58
No need to wake up the thread on every time it schedules to execute the task.

By only park thread if the queue is empty, it can increase the throughput and also fixed the problem of skipping task executions in original changes in 5237ed9

The behavior remains same as the original try/catch impl, but now it's controlled by `jobs.isEmpty()` instead of the try/catch

However still need to check and figure out whether needs to "revert" to base on Pufferfish's original async executor impl.
Using `LockSupport#park/unpark` should be lightweight than using `Condition#await/signal`, but shows opposite throughput result in JMH
Co-Authored-By: Creeam <102713261+HaHaWTH@users.noreply.github.com>
@Dreeam-qwq Dreeam-qwq merged commit 8b3961e into ver/1.21.11 Mar 9, 2026
1 check passed
@Dreeam-qwq Dreeam-qwq deleted the chore/optimize-mob-spawning-cleanup branch March 9, 2026 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: general Pull request for general updates / changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants