From 2ebd640f9c25bf784ff5f68f77d72c041a660fa2 Mon Sep 17 00:00:00 2001 From: mlemanczyk Date: Sat, 10 Jun 2023 13:44:11 +0200 Subject: [PATCH 1/4] RecyclableCollections.Benchmarks baseline changed to List --- .../Benchmarks/RecyclableCollections.Benchmarks.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Recyclable.Collections.Benchmarks/Benchmarks/RecyclableCollections.Benchmarks.cs b/Recyclable.Collections.Benchmarks/Benchmarks/RecyclableCollections.Benchmarks.cs index 69928cc..b741a94 100644 --- a/Recyclable.Collections.Benchmarks/Benchmarks/RecyclableCollections.Benchmarks.cs +++ b/Recyclable.Collections.Benchmarks/Benchmarks/RecyclableCollections.Benchmarks.cs @@ -17,7 +17,7 @@ namespace Recyclable.Collections.Benchmarks public RecyclableCollectionsBenchmarks() : base() { TestObjectCount = 1; - BaselineBenchmarkType = RecyclableCollectionsBenchmarkSource.PooledList; + BaselineBenchmarkType = RecyclableCollectionsBenchmarkSource.List; BenchmarkType = RecyclableCollectionsBenchmarkSource.RecyclableLongList; } @@ -52,7 +52,7 @@ namespace Recyclable.Collections.Benchmarks [Params ( - RecyclableCollectionsBenchmarkSource.PooledList + RecyclableCollectionsBenchmarkSource.List )] public override RecyclableCollectionsBenchmarkSource BaselineBenchmarkType { get => base.BaselineBenchmarkType; set => base.BaselineBenchmarkType = value; } From cc045227fbb524413ef3e2261851982a13b6eaa9 Mon Sep 17 00:00:00 2001 From: mlemanczyk Date: Sat, 10 Jun 2023 13:46:14 +0200 Subject: [PATCH 2/4] Several classes made internal --- Recyclable.Collections/IRandomNumberGenerator.cs | 2 +- Recyclable.Collections/IRecyclableOwner.cs | 2 +- Recyclable.Collections/ListExtensions.cs | 2 +- Recyclable.Collections/MathUtils.cs | 2 +- Recyclable.Collections/MemoryBucket.cs | 2 +- Recyclable.Collections/Recyclable.Collections.csproj | 4 ++-- Recyclable.Collections/RecyclableLongListExtensions.cs | 2 +- Recyclable.Collections/SearchConfiguration.cs | 2 +- Recyclable.Collections/SystemRandomNumberGenerator.cs | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Recyclable.Collections/IRandomNumberGenerator.cs b/Recyclable.Collections/IRandomNumberGenerator.cs index 9199fe4..a4df34f 100644 --- a/Recyclable.Collections/IRandomNumberGenerator.cs +++ b/Recyclable.Collections/IRandomNumberGenerator.cs @@ -1,6 +1,6 @@ namespace Recyclable.Collections { - public interface IRandomNumberGenerator + internal interface IRandomNumberGenerator { int NextInt32(int startIndex, int endIndex); } diff --git a/Recyclable.Collections/IRecyclableOwner.cs b/Recyclable.Collections/IRecyclableOwner.cs index 254c04f..b6eaca2 100644 --- a/Recyclable.Collections/IRecyclableOwner.cs +++ b/Recyclable.Collections/IRecyclableOwner.cs @@ -1,6 +1,6 @@ namespace Recyclable.Collections { - public interface IRecyclableOwner : IList + internal interface IRecyclableOwner : IList { T this[long index] { get; set; } int BlockSize { get; } diff --git a/Recyclable.Collections/ListExtensions.cs b/Recyclable.Collections/ListExtensions.cs index 350a006..866a598 100644 --- a/Recyclable.Collections/ListExtensions.cs +++ b/Recyclable.Collections/ListExtensions.cs @@ -4,7 +4,7 @@ namespace Recyclable.Collections { // The source code was taken from https://codereview.stackexchange.com/questions/205407/quicksort-without-recursion. // It was only beautified for .Net 6.0+. - public static class ListExtensions + internal static class ListExtensions { [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool Contains(this RecyclableList arrays, T item) => arrays.Any(x => x.Contains(item)); diff --git a/Recyclable.Collections/MathUtils.cs b/Recyclable.Collections/MathUtils.cs index aebd3d6..0fe8e7a 100644 --- a/Recyclable.Collections/MathUtils.cs +++ b/Recyclable.Collections/MathUtils.cs @@ -3,7 +3,7 @@ using System.Runtime.CompilerServices; namespace Recyclable.Collections { - public static class MathUtils + internal static class MathUtils { // private static readonly long[] Pow2 = new long[] // { diff --git a/Recyclable.Collections/MemoryBucket.cs b/Recyclable.Collections/MemoryBucket.cs index d786d1a..720a33f 100644 --- a/Recyclable.Collections/MemoryBucket.cs +++ b/Recyclable.Collections/MemoryBucket.cs @@ -1,6 +1,6 @@ namespace Recyclable.Collections { - public class MemoryBucket + internal class MemoryBucket { public MemoryBucket(T[] memory, MemoryBucket nextBucket) { diff --git a/Recyclable.Collections/Recyclable.Collections.csproj b/Recyclable.Collections/Recyclable.Collections.csproj index 0dddff3..33db06d 100644 --- a/Recyclable.Collections/Recyclable.Collections.csproj +++ b/Recyclable.Collections/Recyclable.Collections.csproj @@ -7,7 +7,7 @@ enable true Recyclable.Collections - 0.0.3.1-alpha + 0.0.3.2-alpha Marek Lemańczyk N/A Recyclable.Collections @@ -19,7 +19,7 @@ LICENSE.md README.md git - `RecyclableList<T>` and `RecyclableLongList<T>` implemented. NuGet packages updated. + Several classes made internal to avoid conflicts with other packages. Not ready classes made internal for now. AnyCPU;x64 diff --git a/Recyclable.Collections/RecyclableLongListExtensions.cs b/Recyclable.Collections/RecyclableLongListExtensions.cs index 3ddb0ea..e4e05b0 100644 --- a/Recyclable.Collections/RecyclableLongListExtensions.cs +++ b/Recyclable.Collections/RecyclableLongListExtensions.cs @@ -3,7 +3,7 @@ using System.Runtime.CompilerServices; namespace Recyclable.Collections { - public static class RecyclableLongListExtensions + internal static class RecyclableLongListExtensions { private const int _minPooledArraySize = RecyclableDefaults.MinPooledArrayLength; private const long ItemNotFoundIndexLong = -1L; diff --git a/Recyclable.Collections/SearchConfiguration.cs b/Recyclable.Collections/SearchConfiguration.cs index 0150a28..40cb7ca 100644 --- a/Recyclable.Collections/SearchConfiguration.cs +++ b/Recyclable.Collections/SearchConfiguration.cs @@ -1,6 +1,6 @@ namespace Recyclable.Collections { - public readonly struct SearchConfiguration + internal readonly struct SearchConfiguration { public TItem ItemToFind { get; init; } public TList List { get; init; } diff --git a/Recyclable.Collections/SystemRandomNumberGenerator.cs b/Recyclable.Collections/SystemRandomNumberGenerator.cs index baf7758..ffd8dab 100644 --- a/Recyclable.Collections/SystemRandomNumberGenerator.cs +++ b/Recyclable.Collections/SystemRandomNumberGenerator.cs @@ -1,6 +1,6 @@ namespace Recyclable.Collections { - public class SystemRandomNumberGenerator : IRandomNumberGenerator + internal class SystemRandomNumberGenerator : IRandomNumberGenerator { private readonly Random _random = new(); From b74042d6dba9bc66bada5c5aae61b3cfb7e347d9 Mon Sep 17 00:00:00 2001 From: mlemanczyk Date: Sat, 10 Jun 2023 13:46:25 +0200 Subject: [PATCH 3/4] Tiny formatting fixes. --- Recyclable.Collections.Benchmarks/Program.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Recyclable.Collections.Benchmarks/Program.cs b/Recyclable.Collections.Benchmarks/Program.cs index 644ade4..9df1d4f 100644 --- a/Recyclable.Collections.Benchmarks/Program.cs +++ b/Recyclable.Collections.Benchmarks/Program.cs @@ -45,8 +45,8 @@ public static class Program _ = BenchmarkRunner.Run(BenchmarkConfig); _ = BenchmarkRunner.Run(BenchmarkConfig); _ = BenchmarkRunner.Run(BenchmarkConfig); - _ = BenchmarkRunner.Run(BenchmarkConfig); - //ArraySizeLimitPocBenchmarks>(BenchmarkConfig); + _ = BenchmarkRunner.Run(BenchmarkConfig); + // ArraySizeLimitPocBenchmarks>(BenchmarkConfig); } static void Main(string[] args) @@ -54,6 +54,6 @@ public static class Program RunRecyclableCollectionsBenchmarks(); // RunPocBenchmarks(); // RunSelectedBenchmarks(); - //RunAssemblyBenchmarks(); + // RunAssemblyBenchmarks(); } } From bf625f4048d3791706591afcbe2c4fb2c45299a1 Mon Sep 17 00:00:00 2001 From: mlemanczyk Date: Sat, 10 Jun 2023 13:46:41 +0200 Subject: [PATCH 4/4] Params changed to defaults --- Recyclable.Collections.Benchmarks/POC/PocBenchmarkBase.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Recyclable.Collections.Benchmarks/POC/PocBenchmarkBase.cs b/Recyclable.Collections.Benchmarks/POC/PocBenchmarkBase.cs index 8565d27..522f5fa 100644 --- a/Recyclable.Collections.Benchmarks/POC/PocBenchmarkBase.cs +++ b/Recyclable.Collections.Benchmarks/POC/PocBenchmarkBase.cs @@ -41,10 +41,10 @@ namespace Recyclable.Collections.Benchmarks.POC // [Params(192, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144)] // [Params(524_288, 786_432, 1_048_576)] // [Params(262_144, 393_216, 524_288)] - [Params(850_000)] + //[Params(850_000)] // [Params(RecyclableDefaults.MaxPooledBlockSize)] // [Params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 30, 32, 40, 50, 60, 80, 90, 100, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 10_000_000, 33_554_432, 50_000_000, 100_000_000)] - //[Params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 30, 32, 40, 50, 60, 80, 90, 100, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, RecyclableDefaults.MinItemsCountForParallelization - 1)] + [Params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 30, 32, 40, 50, 60, 80, 90, 100, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, RecyclableDefaults.MinItemsCountForParallelization - 1, RecyclableDefaults.MinItemsCountForParallelization, RecyclableDefaults.MinItemsCountForParallelization * 3)] //[Params(RecyclableDefaults.MinItemsCountForParallelization, 1_048_576, 2_097_152, 4_194_304, 8_388_608, 16_777_216, 33_554_432, RecyclableDefaults.MaxPooledBlockSize)] // [Params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 30, 32, 40, 50, 60, 80, 90, 100, 128)] // [Params(RecyclableDefaults.MinItemsCountForParallelization * 3)]