perf(fill): avoid redundant bounds recomputation
This commit is contained in:
@@ -206,6 +206,7 @@ namespace OpenNest
|
||||
/// </summary>
|
||||
public void UpdateBounds()
|
||||
{
|
||||
PerfCounters.CountPartBoundsUpdate();
|
||||
BoundingBox = Program.BoundingBox();
|
||||
BoundingBox.Offset(Location);
|
||||
}
|
||||
|
||||
@@ -14,12 +14,14 @@ namespace OpenNest
|
||||
private static long partIntersects;
|
||||
private static long fillScoreComputations;
|
||||
private static long partBoundaryPreparations;
|
||||
private static long partBoundsUpdates;
|
||||
|
||||
public static long FindBestFits => Interlocked.Read(ref findBestFits);
|
||||
public static long OffsetPerimeterEntities => Interlocked.Read(ref offsetPerimeterEntities);
|
||||
public static long PartIntersects => Interlocked.Read(ref partIntersects);
|
||||
public static long FillScoreComputations => Interlocked.Read(ref fillScoreComputations);
|
||||
public static long PartBoundaryPreparations => Interlocked.Read(ref partBoundaryPreparations);
|
||||
public static long PartBoundsUpdates => Interlocked.Read(ref partBoundsUpdates);
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void CountFindBestFits() => Interlocked.Increment(ref findBestFits);
|
||||
@@ -37,6 +39,9 @@ namespace OpenNest
|
||||
[Conditional("DEBUG")]
|
||||
public static void CountPartBoundaryPreparation() => Interlocked.Increment(ref partBoundaryPreparations);
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void CountPartBoundsUpdate() => Interlocked.Increment(ref partBoundsUpdates);
|
||||
|
||||
public static void Reset()
|
||||
{
|
||||
Interlocked.Exchange(ref findBestFits, 0);
|
||||
@@ -44,6 +49,7 @@ namespace OpenNest
|
||||
Interlocked.Exchange(ref partIntersects, 0);
|
||||
Interlocked.Exchange(ref fillScoreComputations, 0);
|
||||
Interlocked.Exchange(ref partBoundaryPreparations, 0);
|
||||
Interlocked.Exchange(ref partBoundsUpdates, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user