Sketch: hash sets for the stale-pattern check before each solve (#10493)
* claim: Sketch: use a lookup map for curves in pattern upkeep * Sketch: use a lookup map for curves in pattern upkeep Pattern upkeep runs before every solve, each drag frame included, and looked up every copy curve and its arc points with a linear search over all ids. Dragging another line in a sketch with a 500-copy slot pattern spent about two thirds of each frame there. The ids now resolve through maps built once per call; the result is the same to the bit. The solve bench gains a circular slot pattern section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Sketch: hash sets for the stale-pattern check before each solve The check whether a pattern lost a seed, copy or relation built three ordered sets of all ids before every solve. Only membership is asked, so hash sets give the same answer; a drag frame in a sketch with a 500-copy pattern takes another third less. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Markus Kaltenbrunner <kaltenbrunnermarkus@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
71624cf7fa
commit
fcb0a925e2
@@ -306,9 +306,9 @@ impl Sketch {
|
||||
if self.patterns.is_empty() {
|
||||
return;
|
||||
}
|
||||
let curves: std::collections::BTreeSet<_> = self.curves.iter().map(|c| c.id.as_str()).collect();
|
||||
let points: std::collections::BTreeSet<_> = self.points.iter().map(|p| p.id.as_str()).collect();
|
||||
let constraint_ids: std::collections::BTreeSet<_> = self.constraints.iter().map(|c| c.id.as_str()).collect();
|
||||
let curves: std::collections::HashSet<_> = self.curves.iter().map(|c| c.id.as_str()).collect();
|
||||
let points: std::collections::HashSet<_> = self.points.iter().map(|p| p.id.as_str()).collect();
|
||||
let constraint_ids: std::collections::HashSet<_> = self.constraints.iter().map(|c| c.id.as_str()).collect();
|
||||
let retired: Vec<_> = self
|
||||
.patterns
|
||||
.iter()
|
||||
|
||||
Reference in New Issue
Block a user