Repository navigation
Speed up obstacle detour searches; add collision-heavy benchmark - #14
Merged
Merged
Conversation
The stress graph never leaves a route colliding with a bar or label, so it skips the obstacle detour search and the width-retry loop. The new obstacle-8x12 fixture (skip-column links, long titles) reaches both. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Index boxes by the grid rows and columns they span so each visibility-grid edge is tested only against boxes that can block it, and keep search state in typed arrays. All six benchmark scenes hash identically; the collision-heavy case drops from about 4.3 s to 1.9 s. Add direct avoidObstacles tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
avoidObstacles takes an internal indexed flag; false tests every box on every edge like the previous implementation. A seeded comparison over 200 fields (epsilon boxes, near-touching neighbors, edges on the bounds and past them) asserts identical routes and failures. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
An endpoint inside a box makes avoidObstacles return null before any search, so those trials said nothing about the index. Skip them when counting routed and unrouted outcomes, and note in the obstacle fixture test that its pinned width and counts are meant to be updated after an intended change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…it-5c1539 # Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
obstacle-8x12benchmark case (fixtures/stress.ts,scripts/benchmark-layout.mjs): eight columns of twelve long-titled nodes, about a third of the links skipping a column. The stress graph never leaves a route colliding, so it never reaches the detour search or the width-retry loop; this one does.avoidObstacles: each visibility-grid edge is tested only against boxes whose open row/column range contains it (an axis-aligned segment cannot hit any other box), and search state moves fromMaps to typed arrays. Search budgets, diagnostics and tie-breaking are unchanged.avoidObstaclestests (it had none): seeded random fields including epsilon-sized boxes, plus a wall detour and a sealed case.indexedparameter toavoidObstacles(defaulttrue, not exported fromindex.ts). Withfalseit tests every box on every edge, and a test compares both modes withdeepEqualon 200 seeded fields at two bend costs, including boxes within 1e-5 of a grid line and edges on the bounds. Trials where an endpoint lies inside a box (an earlynull) are not counted. Narrowing the index ranges fails this test; widening them (<to<=) cannot, because the collision check still rejects the extra boxes.obstacleGraph()layout at width 1300 intests/core.test.ts: scene width 1380, 377 crossings, 11 obstacle collisions, and at least one route with long exactly-horizontal and exactly-vertical runs (the detour signature; withavoidObstaclesdisabled this fixture has none). These values are meant to be updated after an intended routing change.docs/performance.mdupdated.Measured (Node, one machine, median of 3 runs)
typecheck,lint,format:check,npm test(156 tests on the head commit) pass;npm run buildwas last run before the final test-only commits. Not run: Playwright browser tests,verify:package, any browser rendering.Not fixed here
Collision-heavy layouts remain slow. When a collision stays unresolved,
layoutGraphStepsre-runs the whole layout at up to six widths and repeats the same detour searches each time (a 175-link variant took about 30 s before this change). Reducing that needs a change to the retry strategy rather than a pure optimization, so it is left for a separate decision. I also tried an exact reachability pre-check before the A* search; it did not help and is not included.🤖 Generated with Claude Code