diff options
| author | mat <git@matdoes.dev> | 2026-03-05 14:58:16 -1245 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2026-03-05 14:58:16 -1245 |
| commit | 62eb3ec38cca04ac09156bb2693a9f8ca82b3da6 (patch) | |
| tree | c43ad03346b0bed34a2d3736e304d3c9cec8a328 | |
| parent | f80cbcb2b8f6ff4c2978e93e6c648c9815475988 (diff) | |
| download | azalea-drasl-62eb3ec38cca04ac09156bb2693a9f8ca82b3da6.tar.xz | |
make cached_mining_costs smaller to speed up the common path
| -rw-r--r-- | azalea/src/pathfinder/world.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/azalea/src/pathfinder/world.rs b/azalea/src/pathfinder/world.rs index 9e9cce83..98b22d70 100644 --- a/azalea/src/pathfinder/world.rs +++ b/azalea/src/pathfinder/world.rs @@ -352,7 +352,7 @@ impl CachedWorld { } // delay initialization so we don't have to create this if it's unused - // this uses about 48mb of memory. it *really* helps though. + // this uses about 2mb of memory. it *really* helps though. *cached_mining_costs = Some( vec![(RelBlockPos::new(i16::MAX, i32::MAX, i16::MAX), 0.); CACHED_MINING_COSTS_SIZE] .into(), @@ -568,13 +568,13 @@ impl CachedWorld { } } -const CACHED_MINING_COSTS_SIZE: usize = 2usize.pow(22); +const CACHED_MINING_COSTS_SIZE: usize = 2usize.pow(18); fn calculate_cached_mining_costs_index(pos: RelBlockPos) -> usize { - // create a 22-bit index by taking the bottom bits from each axis + // create an 18-bit index by taking the bottom bits from each axis - const X_BITS: usize = 8; + const X_BITS: usize = 6; const Y_BITS: usize = 6; - const Z_BITS: usize = 8; + const Z_BITS: usize = 6; const X_MASK: usize = (1 << X_BITS) - 1; const Y_MASK: usize = (1 << Y_BITS) - 1; |
