Skip to content

KB 046: grid Dijkstra flow fields under an unoptimizing managed runtime (C#, Unity editor Mono) - #32

Open
MrJoy wants to merge 2 commits into
CHSZLab:mainfrom
MrJoy:kb/046-grid-dijkstra-managed-runtime
Open

MrJoy wants to merge 2 commits into
CHSZLab:mainfrom
MrJoy:kb/046-grid-dijkstra-managed-runtime

Conversation

@MrJoy

@MrJoy MrJoy commented Nov 27, 2026

Copy link
Copy Markdown

Adds knowledge-base entry 046 and its INDEX.md row.

An AAE session on an 8-connected grid Dijkstra that builds game navigation flow fields, in C# under the Unity editor's Mono JIT. After 10 experiments the recompute went from 40.02 ms to 2.86 ms (-92.9%), with costs matching the original exactly.

Techniques covered: a flat-index kernel, a Dial bucket queue for two small integer step costs, writing out helpers the JIT won't inline, draining each bucket in one pass with its invariants hoisted, a branch-free per-grid neighbor mask, and filling arrays with doubling Array.Copy. The entry also covers two method notes: timing each part separately in the harness, and using an unchanged-code part as a contamination control.

This entry will be updated every 10 experiments while the session runs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01USKFuKJrc8d1h97dAsanH4

MrJoy and others added 2 commits November 27, 2026 11:11

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant