Apoli Stream Leak
Apoli Stream Leak 是专为 Forge 设计的核心模组(coremod),旨在修复 Apoli (Forge) 中可避免的性能问题。
- 由 Nekomaster 委托开发。
- 基于 Genesis: Core 提供支持。
目的
Apoli 是一个第三方库的分发版本,该库内置于 Origins (Forge) 中,模组开发者可以使用它而无需依赖 Origins 的其余部分。在 Apoli 的代码中,存在多处会在客户端和服务端每刻(tick)调用的方法里创建 Stream 的情况。这些 Stream 的创建以及相关的 lambda 表达式内存分配,导致了明显的性能下降,尤其是在连接了多名玩家的服务端上。
Apoli Stream Leak 通过将上述 Stream 的创建替换为传统的 for 循环和其他替代实现,以避免过度的内存占用。效果立竿见影。
性能差异
以下是包含 Apoli 的整合包 Resurvival 的 Spark 性能分析结果:
以下是加入 Apoli Stream Leak 后同一实例的 Spark 性能分析结果:
在 Spark 自身的模组树统计中,搭配 Apoli Stream Leak 后,Apoli 本身每刻耗时减少了 4%。其他直接挂钩到 Apoli 事件的模组,如 Mining Master,也观察到了约 1% 或更多的耗时减少。
对其他解决方案持开放态度
由于缺乏 Apoli (Forge)(注意:并非原版 Apoli 模组)的开源或源码可见仓库,因此创建了 Apoli Stream Leak。我个人愿意将我通过此核心模组所做的更改贡献给 Apoli 本体( preferably 针对 Forge 版本,因为这是我的使用场景)。你可以通过 jonathing.me 联系我。
Apoli Stream Leak
Apoli Stream Leak is a coremod for Forge that aims to fix avoidable performance issues for Apoli (Forge).
- Commissioned by Nekomaster.
- Powered by Genesis: Core.
Purpose
Apoli is a 3rd-party redistribution of a library that comes built-in with Origins (Forge) that modders can use without needing to depend on the rest of Origins. There are several instances within Apoli's code where Streams are created in methods that are called every tick on both the client and server. The creations of these Streams, along with their associated lambda allocations, have caused noticeable performance degradations, especially on servers with multiple players connected.
Apoli Stream Leak overwrites the usages of these Stream creations with traditional for-loops and other alternative implementations in order to avoid excess memory usage. The result is immediate.
Performance Difference
Here is a Spark profile of the Resurvival modpack which contains Apoli:
Here is a Spark profile of the same instance now including Apoli Stream Leak:
Within Spark's own mod tree, Apoli itself sees a 4% decrease in tick time when paired with Apoli Stream Leak. Other mods such as Mining Master, which use events that Apoli directly hooks into, also see a decrease of around 1% or greater.
Open to Other Solutions
Apoli Stream Leak was created due to the absense of a open-source/source-available repository for Apoli (Forge) (NOT to be confused with the original Apoli mod). I am personally open to contributing the changes I have made with this coremod to Apoli itself (preferably for the Forge version as that is my use case). You can find me at jonathing.me.
评论 0
登录后参与评分
还没有评论,来抢沙发吧