GlowstoneMC / Glowstone

A fast, customizable and compatible open source server for Minecraft: Java Edition
https://glowstone.net
Other
1.88k stars 271 forks source link

Parallelism - Pulsing entities and players in parallel divide and conquer manner. #1007

Closed Hagvan closed 5 years ago

Hagvan commented 5 years ago

Utilizes CPU resources better. I tested this using artificial load inside GlowEntity.pulse() method - each pulse every entity generates 10000 random integers. Here are my benchmarks (CPU: Ryzen 2600X): A message is shown every 120 ticks inside each world thread.

Single threaded single thread

ForkJoinPool forkjoinpool

Possible concerns: I know in the future AI for mobs will be added and right now I don't know for sure if it will affect it. What I did is just speed up iteration inside the GlowWorld.pulse() method.