mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-05 02:21:36 -05:00
perf(core): share Program instance in CloneAtOffset
Offset-only copies don't modify program codes, so sharing the instance avoids expensive cloning during large pattern tiling. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
891bb49548
commit
1a9bd795a8
1 file changed
+3
-2
@@ -216,8 +216,9 @@ namespace OpenNest
|
||||
/// </summary>
|
||||
public Part CloneAtOffset(Vector offset)
|
||||
{
|
||||
var clonedProgram = Program.Clone() as Program;
|
||||
var part = new Part(BaseDrawing, clonedProgram,
|
||||
// Share the Program instance — offset-only copies don't modify the program codes.
|
||||
// This is a major performance win for tiling large patterns.
|
||||
var part = new Part(BaseDrawing, Program,
|
||||
location + offset,
|
||||
new Box(BoundingBox.X + offset.X, BoundingBox.Y + offset.Y,
|
||||
BoundingBox.Width, BoundingBox.Length));
|
||||
|
||||
Reference in new issue
Block a user