From d1f3de07d7a3e3ba0bc0146f8909dea094b4e223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Lema=C5=84czyk?= Date: Sat, 18 Oct 2025 14:44:14 +0200 Subject: [PATCH] Add console logs for benchmark data preparation --- .../GpuModularArithmeticBenchmarks.cs | 9 ++++++++- .../MontgomeryMultiplyBenchmarks.cs | 9 ++++++++- EvenPerfectBitScanner.Benchmarks/Pow2ModBenchmarks.cs | 8 +++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/EvenPerfectBitScanner.Benchmarks/GpuModularArithmeticBenchmarks.cs b/EvenPerfectBitScanner.Benchmarks/GpuModularArithmeticBenchmarks.cs index 9367ec3..c4ef16c 100644 --- a/EvenPerfectBitScanner.Benchmarks/GpuModularArithmeticBenchmarks.cs +++ b/EvenPerfectBitScanner.Benchmarks/GpuModularArithmeticBenchmarks.cs @@ -1,3 +1,4 @@ +using System; using System.Runtime.CompilerServices; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Jobs; @@ -51,6 +52,8 @@ public class GpuModularArithmeticBenchmarks private static ModularArithmeticSampleData Create() { + Console.WriteLine("Preparing modular arithmetic benchmark sample data..."); + Random random = new(7); var exponents = new ulong[MaxBatchSize]; var moduli = new ulong[MaxBatchSize]; @@ -66,7 +69,11 @@ public class GpuModularArithmeticBenchmarks mersenneModuli[i] = (1UL << bits) - 1UL; } - return new ModularArithmeticSampleData(exponents, moduli, mersenneModuli, mersenneBitWidths); + ModularArithmeticSampleData data = new ModularArithmeticSampleData(exponents, moduli, mersenneModuli, mersenneBitWidths); + + Console.WriteLine("Finished preparing modular arithmetic benchmark sample data."); + + return data; } private static ulong NextExponent(Random random) diff --git a/EvenPerfectBitScanner.Benchmarks/MontgomeryMultiplyBenchmarks.cs b/EvenPerfectBitScanner.Benchmarks/MontgomeryMultiplyBenchmarks.cs index 9f12ad8..c38c71a 100644 --- a/EvenPerfectBitScanner.Benchmarks/MontgomeryMultiplyBenchmarks.cs +++ b/EvenPerfectBitScanner.Benchmarks/MontgomeryMultiplyBenchmarks.cs @@ -1,3 +1,4 @@ +using System; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Jobs; @@ -51,6 +52,8 @@ public class MontgomeryMultiplyBenchmarks private static MontgomerySampleData Create() { + Console.WriteLine("Preparing Montgomery multiply benchmark sample data..."); + Random random = new(1979); var operandsA = new ulong[MaxBatchSize]; var operandsB = new ulong[MaxBatchSize]; @@ -66,7 +69,11 @@ public class MontgomeryMultiplyBenchmarks operandsB[i] = (ulong)random.NextInt64(0, (long)modulus); } - return new MontgomerySampleData(operandsA, operandsB, moduli, nPrimes); + MontgomerySampleData data = new MontgomerySampleData(operandsA, operandsB, moduli, nPrimes); + + Console.WriteLine("Finished preparing Montgomery multiply benchmark sample data."); + + return data; } private static ulong NextOddModulus(Random random) diff --git a/EvenPerfectBitScanner.Benchmarks/Pow2ModBenchmarks.cs b/EvenPerfectBitScanner.Benchmarks/Pow2ModBenchmarks.cs index 1950403..1aaa776 100644 --- a/EvenPerfectBitScanner.Benchmarks/Pow2ModBenchmarks.cs +++ b/EvenPerfectBitScanner.Benchmarks/Pow2ModBenchmarks.cs @@ -443,6 +443,8 @@ public class Pow2ModBenchmarks private static SampleCollections Create() { + Console.WriteLine("Preparing power-of-two modulus benchmark sample collections..."); + Random random = new(13); Random heuristicRandom = new(113); Random wideRandom = new(19); @@ -486,7 +488,7 @@ public class Pow2ModBenchmarks wideCycles[i] = CalculateCycleLengthWithHeuristics(wideModulus, ref previousWidePrimeOrder); } - return new SampleCollections( + SampleCollections collections = new SampleCollections( smallDivisors, largeDivisors, veryLargeDivisors, @@ -499,6 +501,10 @@ public class Pow2ModBenchmarks largeCycles, veryLargeCycles, wideCycles); + + Console.WriteLine("Finished preparing power-of-two modulus benchmark sample collections."); + + return collections; } private static ulong NextSmallExponent(Random random) => (ulong)random.NextInt64(1L, 1_000_000L);