Implement tiered pathfinding with thread-local scratchpads

- TIER0 (<10 tiles): Vec-based linear search, zero hash overhead
- TIER1 (10-30 tiles): FxHashMap scratchpad with memory reuse
- TIER2 (30-100 tiles): AHashMap scratchpad for better collision resistance
- TIER3 (>100 tiles): Chunk waypoint decomposition
- Added benchmarking infrastructure with F8 report trigger
- Added async infrastructure: PendingPath, CompletedPaths resources
- Lowered MAX_NODES to 5000 to prevent runaway searches

Benchmarks show P50 improved 13%, max improved 53%
This commit is contained in:
2026-03-18 14:37:15 +00:00
parent 49972b9b64
commit 81b70a661c
5 changed files with 1317 additions and 35 deletions
@@ -9,3 +9,21 @@ pub struct Ambulatory {
pub target: Option<Vec3>,
pub step_recovery: u32,
}
#[derive(Component)]
pub struct PendingPath {
pub start: IVec3,
pub goal: IVec3,
pub waypoint_path: Vec<Vec3>,
pub request_id: u64,
}
#[derive(Resource, Default)]
pub struct PathRequestCounter {
pub next_id: u64,
}
#[derive(Resource, Default)]
pub struct CompletedPaths {
pub paths: Vec<(u64, Vec<Vec3>)>,
}
File diff suppressed because it is too large Load Diff