Align scheduler thread count with CLI configuration

This commit is contained in:
Marek Lemańczyk committed 2025-10-20 00:01:21 +02:00
1 parent e4f6cbbe25
commit bad5c28fdf
3 files changed
+75 -6

No files matched your search

+13 -1
View File
@@ -10,9 +10,21 @@ internal static partial class PrimeOrderCalculator
internal readonly struct PrimeOrderSearchConfig(uint smallFactorLimit, int pollardRhoMilliseconds, int maxPowChecks, PrimeOrderMode mode)
{
public static readonly PrimeOrderSearchConfig HeuristicDefault = new(smallFactorLimit: 100_000, pollardRhoMilliseconds: 24, maxPowChecks: 24, PrimeOrderMode.Heuristic);
public static PrimeOrderSearchConfig HeuristicDefault
{
get
{
return CreateHeuristicDefault(UnboundedTaskScheduler.ConfiguredThreadCount);
}
}
public static readonly PrimeOrderSearchConfig StrictDefault = new(smallFactorLimit: 1_000_000, pollardRhoMilliseconds: 0, maxPowChecks: 0, PrimeOrderMode.Strict);
public static PrimeOrderSearchConfig CreateHeuristicDefault(int threadCount)
{
int normalizedThreadCount = threadCount < 1 ? 1 : threadCount;
return new(smallFactorLimit: 100_000, pollardRhoMilliseconds: normalizedThreadCount * 24, maxPowChecks: 24, PrimeOrderMode.Heuristic);
}
public readonly uint SmallFactorLimit = smallFactorLimit;
public readonly int PollardRhoMilliseconds = pollardRhoMilliseconds;
public readonly int MaxPowChecks = maxPowChecks;