perf(fill): short-circuit default comparisons by count

This commit is contained in:
aj
2026-09-25 16:43:09 -04:00
parent 1b862dc1a8
commit b318950a54
7 changed files with 500 additions and 0 deletions
+6
View File
@@ -12,10 +12,12 @@ namespace OpenNest
private static long findBestFits;
private static long offsetPerimeterEntities;
private static long partIntersects;
private static long fillScoreComputations;
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);
[Conditional("DEBUG")]
public static void CountFindBestFits() => Interlocked.Increment(ref findBestFits);
@@ -27,11 +29,15 @@ namespace OpenNest
[Conditional("DEBUG")]
public static void CountPartIntersects() => Interlocked.Increment(ref partIntersects);
[Conditional("DEBUG")]
public static void CountFillScoreComputation() => Interlocked.Increment(ref fillScoreComputations);
public static void Reset()
{
Interlocked.Exchange(ref findBestFits, 0);
Interlocked.Exchange(ref offsetPerimeterEntities, 0);
Interlocked.Exchange(ref partIntersects, 0);
Interlocked.Exchange(ref fillScoreComputations, 0);
}
}
}