COWMODSКаталог модов

EfficientHashing

better hashing algorithm for Vec3i & BlockPos

Автор: ZZZank290,3 тыс.15обновлён 8 окт. 2026 г.
Оптимизация

Описание

EfficientHashing

EfficientHashing replaced hashing algorithm of Vec3i (and its subclasses like BlockPos) with one that's much much more collision resistant, providing performance improvement in basically wherever its hashcode is used.

Collision Resistant

We can prove this by doing a simple test. Test is perform by hashing every combination of BlockPos between new BlockPos(-100, -20, -100) and new BlockPos(100, 50, 100) (inclusive), with the total object count reaching 2,800,000+.

Vanilla algorithm produced 194,571 unique hashcode in total. This means that at least 93% of all BlockPos hashcode are colliding with each other.

And PhiMix, the algorithm used by EfficientHashing, produced 2868471 unique hashcode in total. This means that every unique BlockPos object gets its unique hashcode, and NONE of all BlockPos hashcode are colliding.

Unique HashcodeCollisionCollision Rate
Vanilla194,5712,673,90093.2%
EfficientHashing2,868,47100%

If you're curious about the actual test code, see: here

Performant

Benchmark time:

Benchmark                     Mode  Cnt   Score   Error  Units
VecHashingBenchmark.mixin    thrpt    5  47.012 ± 1.029  ops/s
VecHashingBenchmark.vanilla  thrpt    5  49.326 ± 1.507  ops/s

PhiMix is about 95.3% the performance of original hashing algorithm. Yes, it's slower, but this performance gap is relatively tiny compared to other hashing solution, and can be easily outweighed by the significant improvement in hash collision resistance.

If you're curious about the actual benchmark code, see: here

Vanilla compatible

In vanilla hashing algorithm, if you hash the "default" instance of BlockPos/Vec3i, aka new BlockPos(0, 0, 0), the produced hashcode will be 0, which happens to be the "default" instance of integer. This special behavior is also present in PhiMix, providing the best possible vanilla compatibility.

Последние версии

Все версии →
release

1.0.2 for 26.1.2 neoforge

1.0.2
8 окт. 2026 г.444Minecraft: 26.1.2neoforge
Скачать
Что нового
## Efficient Hashing 1.0.2 - Fix Forge launch issue - Fix mod icon --- ## Efficient Hashing 1.0.1 - 26.1.2 support
release

1.0.2 for 26.1.2 fabric

1.0.2
8 окт. 2026 г.66Minecraft: 26.1.2fabric
Скачать
Что нового
## Efficient Hashing 1.0.2 - Fix Forge launch issue - Fix mod icon --- ## Efficient Hashing 1.0.1 - 26.1.2 support
release

1.0.2 for 1.21.1 neoforge

1.0.2
8 окт. 2026 г.1,8 тыс.Minecraft: 1.21, 1.21.1neoforge
Скачать
Что нового
## Efficient Hashing 1.0.2 - Fix Forge launch issue - Fix mod icon --- ## Efficient Hashing 1.0.1 - 26.1.2 support
release

1.0.2 for 1.21.1 fabric

1.0.2
8 окт. 2026 г.486Minecraft: 1.21, 1.21.1fabric
Скачать
Что нового
## Efficient Hashing 1.0.2 - Fix Forge launch issue - Fix mod icon --- ## Efficient Hashing 1.0.1 - 26.1.2 support
release

1.0.2 for 1.20.1 forge

1.0.2
8 окт. 2026 г.2,3 тыс.Minecraft: 1.20, 1.20.1forge
Скачать
Что нового
## Efficient Hashing 1.0.2 - Fix Forge launch issue - Fix mod icon --- ## Efficient Hashing 1.0.1 - 26.1.2 support
release

1.0.2 for 1.20.1 fabric

1.0.2
8 окт. 2026 г.356Minecraft: 1.20, 1.20.1fabric
Скачать
Что нового
## Efficient Hashing 1.0.2 - Fix Forge launch issue - Fix mod icon --- ## Efficient Hashing 1.0.1 - 26.1.2 support
release

1.0.2 for 1.19.2 forge

1.0.2
8 окт. 2026 г.49Minecraft: 1.19, 1.19.1, 1.19.2forge
Скачать
Что нового
## Efficient Hashing 1.0.2 - Fix Forge launch issue - Fix mod icon --- ## Efficient Hashing 1.0.1 - 26.1.2 support
release

1.0.2 for 1.19.2 fabric

1.0.2
8 окт. 2026 г.6Minecraft: 1.19, 1.19.1, 1.19.2fabric
Скачать
Что нового
## Efficient Hashing 1.0.2 - Fix Forge launch issue - Fix mod icon --- ## Efficient Hashing 1.0.1 - 26.1.2 support
release

1.0.2 for 1.18.2 forge

1.0.2
8 окт. 2026 г.12Minecraft: 1.18, 1.18.1, 1.18.2forge
Скачать
Что нового
## Efficient Hashing 1.0.2 - Fix Forge launch issue - Fix mod icon --- ## Efficient Hashing 1.0.1 - 26.1.2 support
release

1.0.2 for 1.18.2 fabric

1.0.2
8 окт. 2026 г.10Minecraft: 1.18, 1.18.1, 1.18.2fabric
Скачать
Что нового
## Efficient Hashing 1.0.2 - Fix Forge launch issue - Fix mod icon --- ## Efficient Hashing 1.0.1 - 26.1.2 support