关于
FastSuite 会提升所有使用 JSON 配方系统的 mod 的配方匹配性能,而不是只针对某个特定子集的配方。它的实现方式在各个大版本中有所变化——当前实现(7.0.0+)使用的是基于索引的算法。
实现方式
FastSuite 在其生命周期中使用过三种不同的策略:
列表重排(4.0.0 及更早)——配方以移到前端列表的形式存储,因此被频繁访问的配方会向前移动,并在后续查找中变得更容易找到。首次访问与原版速度一致;之后对深层配方的访问可提升 >95%,而对已经靠前的配方影响很小。
并发匹配(4.1.0 – 6.x)——对于任何配方数量超过 100 的配方类型,匹配会分散到多个线程而不是单线程执行。这在 All The Mods 8 中带来了 10x–12x 的加速,而且比重排模型更兼容、也更不脆弱(例如,它与 Polymorph 兼容,并且在首次匹配时也能工作)。
索引匹配(7.0.0+)——当前方案完全放弃并发,改为基于索引的算法。配方会被建立索引,因此只会测试可行候选项,而不是扫描整个列表。对于某个输入的所有配方匹配,这种方式比原版快大约 2x–4.5x,而且没有线程,也没有每次匹配时的数据写入:
\[Indexed\] - Took an average of 93541.68 ns to match all recipes for acacia planks
\[Vanilla\] - Took an average of 416312.28 ns to match all recipes for acacia planks
\[Indexed\] - Took an average of 203072.3 ns to match all recipes for sticks
\[Vanilla\] - Took an average of 523836.38 ns to match all recipes for sticks
\[Indexed\] - Took an average of 104967.54 ns to match all recipes for crafting table
\[Vanilla\] - Took an average of 236834.45 ns to match all recipes for crafting table
\[Indexed\] - Took an average of 212810.42 ns to match all recipes for black shulker box
\[Vanilla\] - Took an average of 453240.12 ns to match all recipes for black shulker box
\[Indexed\] - Took an average of 243105.69 ns to match all recipes for failed match
\[Vanilla\] - Took an average of 918821.25 ns to match all recipes for failed match
如果你在想“等等,4.0.0 - 6.0.0 里的那些数字看起来更好”,那是因为原版的改动把这些优势削弱到了并发匹配几乎等同于单线程匹配的程度。现在基线已经快得多,但索引仍然能做得更好。
兼容性
这个 mod 的设计尽量不干扰其他内容,除非还有另一个 mod 也在替换 recipe manager,否则应该能与其他所有 mod 一起工作。它兼容像 KubeJS 和 CraftTweaker 这样的配方修改 mod,并且不会给 JEI 带来任何问题。
FastSuite 不会替代 FastWorkbench 或 FastFurnace,不过如果安装了它们,它们的收益会被削弱,因为部分工作会被卸载到 FastSuite。为了获得最高的配方性能,我仍然建议把这三个都安装上。
支持我
联系
Discord: https://discord.shadowsoffire.dev
