EfficientHashing
Modby ZZZank
better hashing algorithm for Vec3i & BlockPos
Type
Mod
CurseForge Downloads
325,824
CurseForge ID
1393802
Modrinth Downloads
137,215
Modrinth ID
zEcqovh2
Last Updated
Jun 12, 2026
Description
# 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 Hashcode | Collision | Collision Rate |
|------------------|-----------------|-----------|----------------|
| Vanilla | 194,571 | 2,673,900 | 93.2% |
| EfficientHashing | 2,868,471 | 0 | 0% |
If you're curious about the actual test code, see: [here](https://github.com/ZZZank/EfficientHashing/blob/master/_dev/hashing_java/collisions.md)
### 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](https://github.com/ZZZank/EfficientHashing/blob/master/_dev/hashing_java/benchmark.md)
### 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.
Compatibility
Mod Loaders
Fabric
Forge
Neoforge
Game Versions
1.18
1.18.1
1.18.2
1.19
1.19.1
1.19.2
1.19.3
1.19.4
1.20
1.20.1
+2 more
Similar Mods
Cobblemon Quests
Adds integration between the mod FTB quests and Cobblemon
Mod
4,626,248
Eat an Omelette
Now you can eat omelettes in Minecraft!
Mod
4,621,972
Harder Branch Mining
Encourages caving by configurable depth slower digging and more exhaustion
Mod
4,612,715
Forge Relocation - FMP Plugin
Put parts inside frames? Preposterous!
Mod
4,610,928
Ex Astris
Adding more Mod Support to Ex Nihilo!
Mod
4,610,648
Create Sabers
⚙️ Adds new light sabers to Create
Mod
4,607,148
Included in Modpacks
MTR Railway Network Access - Lite Edition
MTR Railway Network Access - Standard Edition
Architectoribus Datum
IR Railway Network Access (Immersive Railroading)
Rine Time