Skip to content

⚡ Bolt: optimize reachable tiles calculation#91

Merged
b0x1 merged 1 commit into
mainfrom
bolt/optimize-movement-system-3580089957338401489
May 13, 2026
Merged

⚡ Bolt: optimize reachable tiles calculation#91
b0x1 merged 1 commit into
mainfrom
bolt/optimize-movement-system-3580089957338401489

Conversation

@google-labs-jules
Copy link
Copy Markdown
Contributor

This PR optimizes the core movement logic used for unit highlighting and pathfinding. By avoiding string-based Map keys and redundant object allocations in the BFS hot path, the reachable tile calculation is now significantly faster (~2.2x speedup), which improves UI responsiveness during unit selection and movement.


PR created automatically by Jules for task 3580089957338401489 started by @b0x1

- Optimized `MovementSystem.getReachableTiles` by switching to numeric Map keys (y * width + x) to avoid expensive string concatenation.
- Inlined the neighbor search loop to eliminate redundant object and array allocations from `getNeighbors`.
- Maintained memory efficiency for large maps by using a Map instead of a full-map TypedArray, ensuring only visited tiles occupy space.
- Achieved ~2.2x speedup in BFS traversal (benchmarked 3.04ms -> 1.34ms per call).
@google-labs-jules
Copy link
Copy Markdown
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@b0x1 b0x1 merged commit e28d369 into main May 13, 2026
5 checks passed
@b0x1 b0x1 deleted the bolt/optimize-movement-system-3580089957338401489 branch May 13, 2026 05:56
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