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; } diff --git a/Recyclable.Collections.Benchmarks/Program.cs b/Recyclable.Collections.Benchmarks/Program.cs index 644ade4..76350ea 100644 --- a/Recyclable.Collections.Benchmarks/Program.cs +++ b/Recyclable.Collections.Benchmarks/Program.cs @@ -25,35 +25,56 @@ public static class Program //var benchmark = new RecyclableCollectionsBenchmarks(); //benchmark.Setup(); - //foreach (var _ in Enumerable.Range(1, 1000)) - //{ - //benchmark.RecyclableLongList_Remove_FirstItems(); - //benchmark.RecyclableLongList_RemoveAt_LastItems(); - //benchmark.List_RemoveAt_LastItems(); - //} + static void RunAssemblyBenchmarks() + { + _ = BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(new[] { "-f*" }); + } - //benchmark.Cleanup(); - } + static void RunRecyclableCollectionsBenchmarks() + { + _ = BenchmarkRunner.Run(BenchmarkConfig); + } - static void RunPocBenchmarks() - { - _ = BenchmarkRunner.Run(BenchmarkConfig); - _ = BenchmarkRunner.Run(BenchmarkConfig); - _ = BenchmarkRunner.Run(BenchmarkConfig); - _ = BenchmarkRunner.Run(BenchmarkConfig); - _ = BenchmarkRunner.Run(BenchmarkConfig); - _ = BenchmarkRunner.Run(BenchmarkConfig); - _ = BenchmarkRunner.Run(BenchmarkConfig); - _ = BenchmarkRunner.Run(BenchmarkConfig); - _ = BenchmarkRunner.Run(BenchmarkConfig); - //ArraySizeLimitPocBenchmarks>(BenchmarkConfig); - } + static void RunSelectedBenchmarks() + { + // **************** + // *** Template *** + // **************** + var benchmark = new RecyclableCollectionsBenchmarks(); + benchmark.Setup(); + benchmark.RecyclableLongList_IndexOf_BestAndWorstCases(); + benchmark.Cleanup(); - static void Main(string[] args) - { - RunRecyclableCollectionsBenchmarks(); - // RunPocBenchmarks(); - // RunSelectedBenchmarks(); - //RunAssemblyBenchmarks(); + //foreach (var _ in Enumerable.Range(1, 1000)) + //{ + // benchmark.RecyclableLongList_Remove_FirstItems(); + // benchmark.RecyclableLongList_RemoveAt_LastItems(); + // benchmark.List_RemoveAt_LastItems(); + //} + + //benchmark.Cleanup(); + } + + static void RunPocBenchmarks() + { + _ = BenchmarkRunner.Run(BenchmarkConfig); + _ = BenchmarkRunner.Run(BenchmarkConfig); + _ = BenchmarkRunner.Run(BenchmarkConfig); + _ = BenchmarkRunner.Run(BenchmarkConfig); + _ = BenchmarkRunner.Run(BenchmarkConfig); + _ = BenchmarkRunner.Run(BenchmarkConfig); + _ = BenchmarkRunner.Run(BenchmarkConfig); + _ = BenchmarkRunner.Run(BenchmarkConfig); + _ = BenchmarkRunner.Run(BenchmarkConfig); + // ArraySizeLimitPocBenchmarks>(BenchmarkConfig); + } + + static void Main(string[] args) + { + RunRecyclableCollectionsBenchmarks(); + // RunPocBenchmarks(); + // RunSelectedBenchmarks(); + // RunAssemblyBenchmarks(); + } } } 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(); diff --git a/SourceCodeGenerator.Net/RecyclableCollectionsGenerator.cs b/SourceCodeGenerator.Net/RecyclableCollectionsGenerator.cs new file mode 100644 index 0000000..6d22282 --- /dev/null +++ b/SourceCodeGenerator.Net/RecyclableCollectionsGenerator.cs @@ -0,0 +1,19 @@ +using Microsoft.CodeAnalysis; +using System; + +namespace SourceCodeGenerator.Net +{ + [Generator] + public class RecyclableCollectionsGenerator : ISourceGenerator + { + public void Execute(GeneratorExecutionContext context) + { + context.AddSource($".g.cs"); + } + + public void Initialize(GeneratorInitializationContext context) + { + // Nothing to initialize at this point yet + } + } +} diff --git a/SourceCodeGenerator.Net/SourceCodeGenerator.Net.csproj b/SourceCodeGenerator.Net/SourceCodeGenerator.Net.csproj new file mode 100644 index 0000000..aab5db2 --- /dev/null +++ b/SourceCodeGenerator.Net/SourceCodeGenerator.Net.csproj @@ -0,0 +1,16 @@ + + + + netstandard2.0 + True + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + +