perf: Replace linear stitch proximity scan with KDTree #23
Labels
No labels
blocked:children
blocked:depends-101
blocked:depends-103
blocked:depends-104
blocked:needs-attention
blocked:needs-decision
blocked:no-changes
blocked:preflight
bug
chore
feature-request
in-progress
lint-cleanup
needs-decompose
performance
quality
quickfix
security/medium
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/easystitch#23
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
pull_compensation.py:317—_find_nearby_stitches_of_typedoes a full O(n) linear scan of all stitches for every stitch. This makesapply_pull_compensationO(n²). For designs with 10,000+ stitches, this is a major bottleneck.Proposed Fix
Pre-build a
scipy.spatial.KDTreefrom stitch coordinates before the main loop, pre-partition stitches by type, and query neighbors in O(log n).Impact
10-100x faster for large stitch counts.
Files
src/post_processing/pull_compensation.py:94-111, 232, 265, 299-323