Mineuniverse
Log in Register
Mods

EfficientHashing

better hashing algorithm for Vec3i & BlockPos
by ZZZank
Download Claim this project
376,173 downloads
0 likes
Updated Jul 6, 2026
0 hypes
Performance

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.

1. 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

2. 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

3. 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.

efficient_hashing-neoforge-1.0.0+1.21.1-mod.jar
MC 1.21.1, NeoForge
Release 2025-11-28 Get
efficient_hashing-forge-1.0.0+1.20.1-mod.jar
MC 1.20.1, Forge
Release 2025-11-28 Get
efficient_hashing-fabric-1.0.0+1.18.2-mod.jar
MC Fabric, 1.18.2
Release 2025-11-28 Get

More from ZZZank

Open In Inventory
9,161
KubeJEI
844
DataStructium
78,326
JEI Area Fixer
768,276
HUD Config Proxy
487
Logic Chips
413,232

You Might Also Like

Better Biome Reblend
Updated version of Better Biome Blend, a mod that improves and fixes biome color blending
9,432,920
Icterine
Advancements optimization (specifically, InventoryChangeTrigger)
9,118,727
- FPS Booster - Lag Killer
powerful client-side performance FPS booster
97,463
Better Pie Chart
This Mod improves the Vanilla Pile Chart perfect for Minecraft SMP servers
9,603
Enhanced Block Entities Backforged
Reduce FPS lag with block entities, as well as customize them with resource packs. Forge 1.16.5 port of EBE
9,451
Unbinilium
Ubinilium is a Minecraft mod designed to optimize performance and enhance gameplay. It stabilizes FPS, renders distant blocks with reduced detail, and efficiently manages memory.
9,364