Repository navigation
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
0f8eafe to
165931d
Compare
…44, 3049794) `boolean_lists` makes one operand of its N tools by merging them one at a time (`list_operand`, `MergeBrep`). Each merge notifies through a record store with a default record for every object of the operand so far; made from nothing for each merge, the store costs the operand's size every time, so N merges visit the square of N slots. `WorkCounters::merge_record_visits` counts the work on the store of those merges: one for each arena slot, key or record a pass of the key check, the seeding or a reset touches (a slot scanned, emptied ones included; a key made, compared, matched, removed or added; a record reset), tallied in `NotifyRecords` where each pass runs. Outside the count: the ten kinds' own bookkeeping, the progress entries and the map's tree steps. No result reads the tally. The new test cuts 25 and 100 cylinders out of a plate in one call, checks the cut's faces, edges and exact volume, and asks for 930 N + 866 visits: 24116 and 93866. It fails with 199344 and 3049794. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`list_operand` merged each B-rep into the operand through a record store made from nothing, so every merge gave a record to every object of the operand so far: 199344 slot and key visits for 25 tools, 3049794 for 100 (the square of the tools). The merges now share one store. Before each merge it is left exactly as a new one would be when the merge starts (`reseed_records`, as the stitch's glues and the sweep's faces do with theirs: only what the last merge changed, added and removed is visited), under the names the merge itself uses for the operand and its objects. Visits: 24116 and 93866, 930 for each tool and 866. The operand is the same: a unit test merges boxes and cylinders with attributes both ways, fixes on and off, and compares the operand's whole `Debug` dump and the records left after every merge. The one thing a kept store adds is the tag of the operand's removal log, which any stitched B-rep has. `combine_brep` (the offset's single merge) is unchanged: it starts from an empty store. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
165931d to
0dde1c5
Compare
Fixes #3261
boolean_listsmerges its N tools into one operand through one record store instead of a new one for each merge: 930 N + 866 visits in place of about 300 N² (24 116 in place of 199 344 at 25 tools, 93 866 in place of 3 049 794 at 100). No result changes.The problem
boolean_listsmakes one B-rep of each list before it runs the boolean (boolean::merge::p3::list_operand): it copies the first B-rep and merges each other one into the copy (MergeBrep). A merge notifies through a record store that holds a defaultSmTopologyrecord for every object of the operand and for the operand itself. Each merge started from an empty store, so each merge checked and seeded every arena slot of the operand so far: the N merges of a batch cut visited the square of N slots.The change
list_operandkeeps one store for its merges (combine_brep_keeping). Before each merge the kept store is left exactly as a new one would be when the merge starts: a default record for every object of the operand and for the operand, and no other (reseed_records, the function the stitch's glues and the sweep's faces already use for their kept store). It runs under the names the merge itself uses (notify_reffor the objects,brep_reffor the operand).combine_brepis unchanged for its other caller (the offset's single merge): it starts from an empty store.WorkCounters::merge_record_visitscounts the store's work, for the test: one for each arena slot, key or record a pass touches (a slot scanned for a live object, emptied ones included; a key made, compared, matched, removed or added; a record reset), in the key check and the seeding of the operand, the key check and the seeding of the B-rep merged in, and a reset. Outside the count: the ten kinds' own bookkeeping, the progress entries (one for each B-rep value) and the steps of the map's tree. The tally is kept inNotifyRecordswhere each pass runs; no result reads it.The store is local to one
list_operandcall: no kernel state, nothing shared between calls or threads.Counts
Plate
20 n x 20 n x 12minus N = n² cylinders r 4 in oneboolean_listscall, SolidCraft's fixes:25 and 100 are the committed test's own output before and after the fix; 200 was measured by a reviewer.
Why no result changes
The store a merge's edit runs on holds the same keys with the same default records whether it was made new or kept and reset, so the merge, its notifications and the attributes it propagates are the same.
Debugdump and the records left after every merge.One thing differs in the B-rep value and is not a result: the operand's removal log gets its tag (
Brep::removal_tag), whichreseed_recordsnames the value by. Every stitched B-rep has it; it is not serialized, and a copy or a rollback starts a new one. Removals are logged whether or not the tag exists.Tests
list_operand_merges_visit_records_in_proportion_to_the_tools(committed first, failing with(199344, 3049794)against(24116, 93866)): the counts, with the cut's faces, edges and exact volume.merges_that_keep_their_record_store_make_the_same_operand: as above.Verification
On
0dde1c534, rebased on maindc5cfd7e7, Linux (WSL Ubuntu 22.04):cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings,check_panic_sites.py,check_record_ids.py,check-frozen-archives.sh,cargo check -p solidcore --target wasm32-unknown-unknown: all exit 0.--all --goldens:goldens: 283 unit(s), 282 passed, 1 failed. The one iscurve.coniccasegen2235(values.r[4]: 3.776586443654626e-14 -> 3.552713678800501e-14), which differs the same way on unchanged main on that machine (checked onba55b2f71and on7b29ffdb5); this change does not touch it.(199344, 3049794); at the head it passes with(24116, 93866).boolean_api,boolean_no_dangling_vertex_refs,issue_1120_boolean_slitspass. The focused lib tests (boolean::merge,topology::brep::p3,topology::topology,kernel::tests) pass: 131.ba55b2f71, together with four other changes on one branch: the whole workspace suite (7181 passed, 113 skipped) and the kernel rig as CI runs it (1081 cases, 803 pass, 0 fail, 15 known-failing, none moved). Not re-run on this head: CI is the gate.Not attached
Not in this PR
copy_componentand the other callers that make a store per edit.🤖 Generated with Claude Code
Summary by CodeRabbit