Clarify cycle stepper reset inlining
This commit is contained in:
1 parent
8b467c27f3
commit
b8aa845c5c
53 files changed
+1736
-1131
No files matched your search
@@ -8,6 +8,8 @@ public static class AlphaCalculations
|
||||
{
|
||||
int exponent = checked(4 * k + 1);
|
||||
EInteger y = PowerCache.Get(p, exponent);
|
||||
// TODO: Reuse pooled numerator/denominator buffers here so the alphaP computation stops allocating
|
||||
// intermediate EInteger instances every invocation.
|
||||
return ERational.Create(y * p - 1, y * (p - 1));
|
||||
}
|
||||
|
||||
@@ -15,6 +17,9 @@ public static class AlphaCalculations
|
||||
{
|
||||
EInteger num = PowerCache.Get(q, a2 + 1) - EInteger.One;
|
||||
EInteger den = PowerCache.Get(q, a2) * (q - EInteger.One);
|
||||
// TODO: Reuse pooled ERational builders here so repeated factor computations pull precomputed
|
||||
// numerator/denominator tuples instead of re-executing PowerCache chains each time, matching the
|
||||
// fastest alpha benchmarks.
|
||||
return ERational.Create(num, den);
|
||||
}
|
||||
|
||||
@@ -22,7 +27,11 @@ public static class AlphaCalculations
|
||||
{
|
||||
ERational result = ERational.One;
|
||||
for (int i = 0; i < maxR; i++)
|
||||
{
|
||||
// TODO: Replace the repeated Multiply calls with a span-based aggregator that batches factors,
|
||||
// avoiding transient ERational instances when maxR grows large.
|
||||
result = result.Multiply(ComputeAlphaFactor(primes[i], a2));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user