9
0
mirror of https://github.com/SparklyPower/SparklyPaper.git synced 2025-12-19 15:09:27 +00:00

[ci skip] README changes (again)

This commit is contained in:
MrPowerGamerBR
2023-11-21 23:33:27 -03:00
parent af841d584c
commit 6e8885ab81

View File

@@ -40,6 +40,7 @@ SparklyPaper's config file is `sparklypaper.yml`, the file is, by default, place
* On each tick, Paper runs `EntityScheduler`'s `executeTick` of each entity. This is a bit expensive, due to `ArrayDeque`'s `size()` call because it ain't a simple "get the current queue size" function, due to the thread checks, and because it needs to iterate all server entities to tick them.
* To avoid those hefty calls, instead of iterating all entities in all worlds, we use a set to track which entities have scheduled tasks that we need to tick. When a task is scheduled, we add the entity to the set, when all entity tasks are executed, the entity is removed from the set. We don't need to care about entities that do not have any tasks scheduled, even if the scheduler has a `tickCount`, because `tickCount` is relative and not bound to the server's current tick, so it doesn't matter if we don't increase it.
* Most entities won't have any scheduled tasks, so this is a nice performance bonus, even if you have plugins that do use the entity scheduler because, for 99,99% of use cases, you aren't going to create tasks for all entities in your server. With this change, the `executeTick` loop in `tickChildren` CPU % usage drops from 8.40% to 0.00% (!!!) in a server with ~15k entities! Sweet!
* Yeah, I know... "but you are cheating! the loop doesn't show up in the profiler because you replaced the loop with a for each!" and you are right! Here's a comparison of the `tickChildren` function CPU usage % between vanilla Paper and SparklyPaper, removing all other functions from the profiler result: 7.70% vs 0.02%
* Of course, this doesn't mean that `ArrayDeque#size()` is slow! It is mostly that because the `executeTick` function is called each tick for each entity, it would be better for us to avoid as many useless calls as possible.
* Blazingly Simple Farm Checks
* Changes Minecraft's farm checks for crops, stem blocks, and farm lands to be simpler and less resource intensive