Tiny cleanup and performance improvements
This commit is contained in:
1 parent
8b95a42f27
commit
845ce41dd8
1 file changed
+3
-4
@@ -863,8 +863,7 @@ internal static class Program
|
||||
for (int workerIndex = 0; workerIndex < workers.Length; workerIndex++)
|
||||
{
|
||||
int capturedStateCount = stateCount;
|
||||
workers[workerIndex] = Task.Factory.StartNew(
|
||||
() =>
|
||||
workers[workerIndex] = Task.Factory.StartNew(() =>
|
||||
{
|
||||
using var session = _byDivisorTester!.CreateDivisorSession();
|
||||
byte[] hitsBuffer = ArrayPool<byte>.Shared.Rent(capturedStateCount);
|
||||
@@ -1018,7 +1017,7 @@ internal static class Program
|
||||
private static ulong AcquireNextDivisor(ref ulong nextDivisor, ulong divisorLimit, ref int divisorsExhaustedFlag, ref long finalDivisorBits, out bool exhausted, ref ulong localDivisorCursor, ref int localDivisorsRemaining)
|
||||
{
|
||||
ref long nextDivisorBits = ref Unsafe.As<ulong, long>(ref nextDivisor);
|
||||
ulong blockStride = unchecked((ulong)(DivisorAllocationBlockSize * 2));
|
||||
ulong blockStride = unchecked(DivisorAllocationBlockSize * 2);
|
||||
|
||||
if (localDivisorsRemaining > 0)
|
||||
{
|
||||
@@ -1082,7 +1081,7 @@ internal static class Program
|
||||
}
|
||||
}
|
||||
|
||||
private static int BuildPrimeBuffer(ulong divisor, ulong[] primeValues, ulong[] allowedMaxValues, int[] stateFlags, ulong[] primeBuffer, int[] indexBuffer, PendingResult[] completionsBuffer, ref int completionsCount, ref int remainingStates, long[] activeStateMask, ref int activeStartIndex)
|
||||
private static int BuildPrimeBuffer(ulong divisor, in ulong[] primeValues, in ulong[] allowedMaxValues, int[] stateFlags, ulong[] primeBuffer, int[] indexBuffer, PendingResult[] completionsBuffer, ref int completionsCount, ref int remainingStates, long[] activeStateMask, ref int activeStartIndex)
|
||||
{
|
||||
int length = primeValues.Length;
|
||||
int startIndex = Volatile.Read(ref activeStartIndex);
|
||||
|
||||
Reference in new issue
Block a user