From 2042c7d3f2cfaba01ec2aacfad362c9572f3c811 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Sun, 15 Mar 2026 13:35:30 -0400 Subject: [PATCH] perf(engine): cap strip-mode pair candidates at 100 (sorted by utilization) Strip mode was adding thousands of candidates (7600+) when the work area was narrow. Now caps at 100 total, sorted by utilization descending so the best candidates are tried first. Co-Authored-By: Claude Opus 4.6 (1M context) --- OpenNest.Engine/NestEngine.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenNest.Engine/NestEngine.cs b/OpenNest.Engine/NestEngine.cs index 67a36a0..79d8aab 100644 --- a/OpenNest.Engine/NestEngine.cs +++ b/OpenNest.Engine/NestEngine.cs @@ -594,12 +594,16 @@ namespace OpenNest { var stripCandidates = bestFits .Where(r => r.ShortestSide <= workShortSide + Tolerance.Epsilon - && r.Utilization >= 0.3); + && r.Utilization >= 0.3) + .OrderByDescending(r => r.Utilization); var existing = new HashSet(top); foreach (var r in stripCandidates) { + if (top.Count >= 100) + break; + if (existing.Add(r)) top.Add(r); }