Zefir's Optimizations
Zefir's Optimizations 是一款 Fabric 模组,通过 Akka 执行器(actors)实现实体的并行移动。它主要侧重于将生物和盔甲架的移动计时从主线程中分离出来。这可以逐步提升多核服务器的性能。
其工作原理是为每个 MobEntity 和 ArmorStand 附加一个执行器,并重定向移动调用,使其在不同线程上执行。目前仅实现了来自 Entity 和 LivingEntity 的基本移动逻辑。
你至少需要 2 个核心才能看到差异!核心越多,效果越好。
工作原理
每个生物和盔甲架都会获得自己的执行器。当实体需要进行移动逻辑计时时,异步计时管理器会通知相应的实体执行器进行处理。实体执行器接收其邮箱中的消息,并逐个处理它们。
出于安全考虑,某些操作(如造成伤害或拾取物品)必须在主线程上执行。当实体执行器需要执行其中一项操作时,它会向主线程执行器发送消息,由后者在主线程上完成工作。
目前,实体执行器实现了 LivingEntity 和 MobEntity 中的 tickMovement() 和 travel() 方法(盔甲架从 LivingEntity 继承这些方法)。

它可能会并且将会非常不稳定。它可能会损坏你的实体、世界甚至你的狗。请知悉风险。
在我们的 Discord 中报告任何问题!
Zefir's Optimizations
Zefir's Optimizations is a Fabric mod that adds parallel entity movement using Akka actors. It focuses primarily on separating the movement ticking of mobs and armor stands from the main thread. This can gradually improve the performance on the multi-core server.
It works by attaching an actor to each MobEntity and ArmorStand and redirecting movement calls and executing them on diffirent thread. For now, only the basic movement logic from Entity and LivingEntity is implemented.
You must to have atleast 2 cores to see the diffirence! The more cores, the better.
How it works
Each mob and armor stand gets its own actor. When it's time for the entity to tick its movement logic, the Async Tick Manager tells the corresponding Entity Actor to do the work. The Entity Actor receives messages to its mailbox and processes them one by one.
Some actions, like dealing damage or picking up items, must be done on the main thread for safety reasons. When an Entity Actor needs to do one of these actions, it sends a message to the Main Thread Actor that do the work on main thread.
For now, Entity Actor implements tickMovement() and travel() from LivingEntity and MobEntity (armor stand inherits it form LivingEntity).

It may and will be VERY broken. It can broke your etities, your world and your dog. You have been warned.
Rport any issues in our Discord!
评论 0
登录后参与评分
还没有评论,来抢沙发吧