Skip to content

Cluster search: a box for each edge of small rings, chunks tried by their boxes first - #9

Merged
MagicalTux merged 1 commit into
masterfrom
cluster-leaves
Nov 24, 2026
Merged

MagicalTux merged 1 commit into
masterfrom
cluster-leaves

Conversation

@MagicalTux

Copy link
Copy Markdown
Member

Follow-up to #7, before 0.0.7 is released: the repository's own pour benchmark (examples/perf.rs cadlab, the pour of testdata/) was slower with #7 than with 0.0.6, which the recorded openings measured for #7 did not show.

The search for clusters by the distance of edges gave a ring one box for every sixteen consecutive edges. A board outline of four edges (sixteen once offset) was then one box over the whole board: every hole inside it went down its own tree to every leaf and tried each of its edges with each of the outline's, 16 box tests an edge of input. The search ran out of its budget in the grow of the opening and that union was computed in one piece.

Now a ring of n edges has boxes of n / 8 edges, between one and sixteen; two chunks whose boxes come within reach first have their edges tried against the other chunk's box, and only those within its reach against each other; the budget is 16 box tests an edge of input for 8.

examples/perf.rs cadlab, one thread, ms:

0.0.6 #7 this
opening by 100 um 620 730 110
offset by -100 um 80 47 35
offset by +100 um 577 687 76
union with 40 spokes 12.5 141 7.0

The recorded openings of #7 are as they were (5.6 s for the largest set, 3.5 s with a memo). Same output: the hash of every vertex of every result on the recorded calls and on this pour is that of 0.0.6, without rayon and with it on one and four threads, with and without a memo, and with every reused result computed and compared.

Checked here: cargo fmt --check, clippy with all features (-D warnings), the tests in release with all features, the cluster and memo tests in debug. Not run here: the i686 target, Windows and macOS (CI), the fuzz targets, the Clipper2 oracle.

🤖 Generated with Claude Code

… by their boxes first

The search for clusters by the distance of edges gave a ring one box for
every sixteen consecutive edges. A board outline of four edges, or of
sixteen once offset, was then one box over the whole board: every hole
inside it went down its own tree to every leaf and tried each of its
edges with each of the outline's, 16 box tests an edge of input. On the
pour of testdata/ (242 k vertices, 2153 holes) the search ran out of its
budget in the grow of an opening and the union was computed in one
piece: 730 ms for the 620 ms of 0.0.6, and the union with 40 spokes
141 ms for 12.5 ms.

A ring of n edges now has boxes of n / 8 edges, between one and sixteen,
so the sides of a small ring have a box each; two chunks whose boxes
come within reach first have their edges tried against the other
chunk's box, and only those within its reach against each other; and
the budget is 16 box tests an edge of input for 8.

examples/perf.rs cadlab, one thread (0.0.6, the commit before, this):
opening 620, 730, 110 ms; offset by -100 um 80, 47, 35 ms; by +100 um
577, 687, 76 ms; union with 40 spokes 12.5, 141, 7.0 ms. The recorded
openings of three boards are as they were (cynthion 5.6 s, 3.5 s with a
memo). Same output: the hash of every vertex of every result on the
recorded calls and this pour, with and without rayon and a memo.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@MagicalTux
MagicalTux merged commit a30414f into master Nov 24, 2026
8 checks passed
@MagicalTux
MagicalTux deleted the cluster-leaves branch November 24, 2026 20:02
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