From b64cc508faa936c3453b524e079d1e9722040c3e Mon Sep 17 00:00:00 2001 From: Rafael Sliveira Cordeiro Date: Mon, 4 Dec 2023 23:45:07 -0800 Subject: [PATCH 01/16] Add More Benchmarks --- .../Basic/01-Singleton/Classes.cs | 29 +++++++ .../Basic/01-Singleton/SingletonBenchmark.cs | 65 +++++++++++++++ .../Basic/02-Transient/Classes.cs | 29 +++++++ .../Basic/02-Transient/TransientBenchmark.cs | 65 +++++++++++++++ .../Basic/03-Scoped/Classes.cs | 29 +++++++ .../Basic/03-Scoped/ScopedBenchmark.cs | 68 ++++++++++++++++ src/Jab.Performance/Basic/04-Mixed/Classes.cs | 81 +++++++++++++++++++ .../Basic/04-Mixed/MixedBenchmark.cs | 81 +++++++++++++++++++ 8 files changed, 447 insertions(+) create mode 100644 src/Jab.Performance/Basic/01-Singleton/Classes.cs create mode 100644 src/Jab.Performance/Basic/01-Singleton/SingletonBenchmark.cs create mode 100644 src/Jab.Performance/Basic/02-Transient/Classes.cs create mode 100644 src/Jab.Performance/Basic/02-Transient/TransientBenchmark.cs create mode 100644 src/Jab.Performance/Basic/03-Scoped/Classes.cs create mode 100644 src/Jab.Performance/Basic/03-Scoped/ScopedBenchmark.cs create mode 100644 src/Jab.Performance/Basic/04-Mixed/Classes.cs create mode 100644 src/Jab.Performance/Basic/04-Mixed/MixedBenchmark.cs diff --git a/src/Jab.Performance/Basic/01-Singleton/Classes.cs b/src/Jab.Performance/Basic/01-Singleton/Classes.cs new file mode 100644 index 0000000..6f0d841 --- /dev/null +++ b/src/Jab.Performance/Basic/01-Singleton/Classes.cs @@ -0,0 +1,29 @@ +namespace Jab.Performance.Basic.Singleton; + +public interface ISingleton1 +{ + void SayHi(); +} + +public interface ISingleton2 +{ + void SayHi(); +} + +public interface ISingleton3 +{ + void SayHi(); +} + +public class Singleton1() : ISingleton1 +{ + public void SayHi() => Console.WriteLine("Hello from Singleton 1"); +} +public class Singleton2() : ISingleton2 +{ + public void SayHi() => Console.WriteLine("Hello from Singleton 2"); +} +public class Singleton3() : ISingleton3 +{ + public void SayHi() => Console.WriteLine("Hello from Singleton 3"); +} diff --git a/src/Jab.Performance/Basic/01-Singleton/SingletonBenchmark.cs b/src/Jab.Performance/Basic/01-Singleton/SingletonBenchmark.cs new file mode 100644 index 0000000..4b358b5 --- /dev/null +++ b/src/Jab.Performance/Basic/01-Singleton/SingletonBenchmark.cs @@ -0,0 +1,65 @@ +namespace Jab.Performance.Basic.Singleton; + +using BenchmarkDotNet.Attributes; +using Microsoft.Extensions.DependencyInjection; +using MEDI = Microsoft.Extensions.DependencyInjection; + + +[MemoryDiagnoser] +public class SingletonBenchmark +{ + private readonly MEDI.ServiceProvider _provider; + private readonly ContainerSingleton _container = new(); + + public SingletonBenchmark() + { + var serviceCollection = new ServiceCollection(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + _provider = serviceCollection.BuildServiceProvider(); + } + + [Params(1, 10, 100)] + public int NumbersOfCalls { get; set; } + + [Params(1, 2, 3)] + public int NumbersOfClasses { get; set; } + + [Benchmark(Baseline = true)] + public void Jab() + { + for (var i = 0; i < NumbersOfCalls; i++) + { + + if (NumbersOfClasses >= 1) + _container.GetService(); + if (NumbersOfClasses >= 2) + _container.GetService(); + if (NumbersOfClasses >= 3) + _container.GetService(); + } + } + + [Benchmark] + public void MEDI() + { + for (var i = 0; i < NumbersOfCalls; i++) + { + if (NumbersOfClasses >= 1) + _provider.GetService(); + if(NumbersOfClasses >= 2) + _provider.GetService(); + if (NumbersOfClasses >= 3) + _provider.GetService(); + } + } +} + +[ServiceProvider] +[Singleton(typeof(ISingleton1), typeof(Singleton1))] +[Singleton(typeof(ISingleton2), typeof(Singleton2))] +[Singleton(typeof(ISingleton3), typeof(Singleton3))] +internal partial class ContainerSingleton +{ +} \ No newline at end of file diff --git a/src/Jab.Performance/Basic/02-Transient/Classes.cs b/src/Jab.Performance/Basic/02-Transient/Classes.cs new file mode 100644 index 0000000..0b897f4 --- /dev/null +++ b/src/Jab.Performance/Basic/02-Transient/Classes.cs @@ -0,0 +1,29 @@ +namespace Jab.Performance.Basic.Transient; + +public interface ITransient1 +{ + void SayHi(); +} + +public interface ITransient2 +{ + void SayHi(); +} + +public interface ITransient3 +{ + void SayHi(); +} + +public class Transient1() : ITransient1 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 1"); +} +public class Transient2() : ITransient2 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 2"); +} +public class Transient3() : ITransient3 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 3"); +} diff --git a/src/Jab.Performance/Basic/02-Transient/TransientBenchmark.cs b/src/Jab.Performance/Basic/02-Transient/TransientBenchmark.cs new file mode 100644 index 0000000..aa77029 --- /dev/null +++ b/src/Jab.Performance/Basic/02-Transient/TransientBenchmark.cs @@ -0,0 +1,65 @@ +namespace Jab.Performance.Basic.Transient; + +using BenchmarkDotNet.Attributes; +using Microsoft.Extensions.DependencyInjection; +using MEDI = Microsoft.Extensions.DependencyInjection; + + +[MemoryDiagnoser] +public class TransientBenchmark +{ + private readonly MEDI.ServiceProvider _provider; + private readonly ContainerTransient _container = new(); + + public TransientBenchmark() + { + var serviceCollection = new ServiceCollection(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + _provider = serviceCollection.BuildServiceProvider(); + } + + [Params(1, 10, 100)] + public int NumbersOfCalls { get; set; } + + [Params(1, 2, 3)] + public int NumbersOfClasses { get; set; } + + [Benchmark(Baseline = true)] + public void Jab() + { + for (var i = 0; i < NumbersOfCalls; i++) + { + + if (NumbersOfClasses >= 1) + _container.GetService(); + if (NumbersOfClasses >= 2) + _container.GetService(); + if (NumbersOfClasses >= 3) + _container.GetService(); + } + } + + [Benchmark] + public void MEDI() + { + for (var i = 0; i < NumbersOfCalls; i++) + { + if (NumbersOfClasses >= 1) + _provider.GetService(); + if(NumbersOfClasses >= 2) + _provider.GetService(); + if (NumbersOfClasses >= 3) + _provider.GetService(); + } + } +} + +[ServiceProvider] +[Transient(typeof(ITransient1), typeof(Transient1))] +[Transient(typeof(ITransient2), typeof(Transient2))] +[Transient(typeof(ITransient3), typeof(Transient3))] +internal partial class ContainerTransient +{ +} \ No newline at end of file diff --git a/src/Jab.Performance/Basic/03-Scoped/Classes.cs b/src/Jab.Performance/Basic/03-Scoped/Classes.cs new file mode 100644 index 0000000..068e65a --- /dev/null +++ b/src/Jab.Performance/Basic/03-Scoped/Classes.cs @@ -0,0 +1,29 @@ +namespace Jab.Performance.Basic.Scoped; + +public interface IScoped1 +{ + void SayHi(); +} + +public interface IScoped2 +{ + void SayHi(); +} + +public interface IScoped3 +{ + void SayHi(); +} + +public class Scoped1() : IScoped1 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 1"); +} +public class Scoped2() : IScoped2 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 2"); +} +public class Scoped3() : IScoped3 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 3"); +} diff --git a/src/Jab.Performance/Basic/03-Scoped/ScopedBenchmark.cs b/src/Jab.Performance/Basic/03-Scoped/ScopedBenchmark.cs new file mode 100644 index 0000000..6dcd10c --- /dev/null +++ b/src/Jab.Performance/Basic/03-Scoped/ScopedBenchmark.cs @@ -0,0 +1,68 @@ +namespace Jab.Performance.Basic.Scoped; + +using BenchmarkDotNet.Attributes; +using Microsoft.Extensions.DependencyInjection; +using MEDI = Microsoft.Extensions.DependencyInjection; + + +[MemoryDiagnoser] +public class ScopedBenchmark +{ + private readonly MEDI.ServiceProvider _provider; + private readonly ContainerScoped _container = new(); + + public ScopedBenchmark() + { + var serviceCollection = new ServiceCollection(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + _provider = serviceCollection.BuildServiceProvider(); + } + + [Params(1, 10, 100)] + public int NumbersOfCalls { get; set; } + + [Params(1, 2, 3)] + public int NumbersOfClasses { get; set; } + + [Benchmark(Baseline = true)] + public void Jab() + { + for (var i = 0; i < NumbersOfCalls; i++) + { + using var scope = _container.CreateScope(); + + if (NumbersOfClasses >= 1) + _container.GetService(); + if (NumbersOfClasses >= 2) + _container.GetService(); + if (NumbersOfClasses >= 3) + _container.GetService(); + } + } + + [Benchmark] + public void MEDI() + { + for (var i = 0; i < NumbersOfCalls; i++) + { + using var scope = _provider.CreateScope(); + + if (NumbersOfClasses >= 1) + _provider.GetService(); + if(NumbersOfClasses >= 2) + _provider.GetService(); + if (NumbersOfClasses >= 3) + _provider.GetService(); + } + } +} + +[ServiceProvider] +[Scoped(typeof(IScoped1), typeof(Scoped1))] +[Scoped(typeof(IScoped2), typeof(Scoped2))] +[Scoped(typeof(IScoped3), typeof(Scoped3))] +internal partial class ContainerScoped +{ +} \ No newline at end of file diff --git a/src/Jab.Performance/Basic/04-Mixed/Classes.cs b/src/Jab.Performance/Basic/04-Mixed/Classes.cs new file mode 100644 index 0000000..2599bf3 --- /dev/null +++ b/src/Jab.Performance/Basic/04-Mixed/Classes.cs @@ -0,0 +1,81 @@ +namespace Jab.Performance.Basic.Scoped; + +using Jab.Performance.Basic.Singleton; +using Jab.Performance.Basic.Transient; + +public interface IMix1 +{ + void SayHi(); +} + +public interface IMix2 +{ + void SayHi(); +} + +public interface IMix3 +{ + void SayHi(); +} + +public class Mix1 : IMix1 +{ + private readonly ISingleton1 _first; + private readonly ITransient1 _second; + public Mix1(ISingleton1 first, ITransient1 second) + { + ArgumentNullException.ThrowIfNull(first); + ArgumentNullException.ThrowIfNull(second); + this._first = first; + this._second = second; + } + + public void SayHi() + { + Console.WriteLine($"Hello from Combined 1"); + this._first.SayHi(); + this._second.SayHi(); + } +} + +public class Mix2 : IMix2 +{ + private readonly ISingleton2 _first; + private readonly ITransient2 _second; + public Mix2(ISingleton2 first, ITransient2 second) + { + ArgumentNullException.ThrowIfNull(first); + ArgumentNullException.ThrowIfNull(second); + this._first = first; + this._second = second; + } + + public void SayHi() + { + Console.WriteLine($"Hello from Combined 2"); + this._first.SayHi(); + this._second.SayHi(); + } +} + + +public class Mix3 : IMix3 +{ + private readonly ISingleton3 _first; + private readonly ITransient3 _second; + public Mix3(ISingleton3 first, ITransient3 second) + { + ArgumentNullException.ThrowIfNull(first); + ArgumentNullException.ThrowIfNull(second); + this._first = first; + this._second = second; + } + + public void SayHi() + { + Console.WriteLine($"Hello from Combined 3"); + this._first.SayHi(); + this._second.SayHi(); + } +} + diff --git a/src/Jab.Performance/Basic/04-Mixed/MixedBenchmark.cs b/src/Jab.Performance/Basic/04-Mixed/MixedBenchmark.cs new file mode 100644 index 0000000..01c2f6b --- /dev/null +++ b/src/Jab.Performance/Basic/04-Mixed/MixedBenchmark.cs @@ -0,0 +1,81 @@ +namespace Jab.Performance.Basic.Scoped; + +using BenchmarkDotNet.Attributes; +using Jab.Performance.Basic.Singleton; +using Jab.Performance.Basic.Transient; +using Microsoft.Extensions.DependencyInjection; +using MEDI = Microsoft.Extensions.DependencyInjection; + +[MemoryDiagnoser] +public class MixedBenchmark +{ + private readonly MEDI.ServiceProvider _provider; + private readonly ContainerCombined _container = new(); + + public MixedBenchmark() + { + var serviceCollection = new ServiceCollection(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + _provider = serviceCollection.BuildServiceProvider(); + } + + [Params(1, 10, 100)] + public int NumbersOfCalls { get; set; } + + [Params(1, 2, 3)] + public int NumbersOfClasses { get; set; } + + [Benchmark(Baseline = true)] + public void Jab() + { + for (var i = 0; i < NumbersOfCalls; i++) + { + using var scope = _container.CreateScope(); + + if (NumbersOfClasses >= 1) + _container.GetService(); + if (NumbersOfClasses >= 2) + _container.GetService(); + if (NumbersOfClasses >= 3) + _container.GetService(); + } + } + + [Benchmark] + public void MEDI() + { + for (var i = 0; i < NumbersOfCalls; i++) + { + using var scope = _provider.CreateScope(); + + if (NumbersOfClasses >= 1) + _provider.GetService(); + if(NumbersOfClasses >= 2) + _provider.GetService(); + if (NumbersOfClasses >= 3) + _provider.GetService(); + } + } +} + +[ServiceProvider] +[Transient(typeof(IMix1), typeof(Mix1))] +[Transient(typeof(IMix2), typeof(Mix2))] +[Transient(typeof(IMix3), typeof(Mix3))] +[Transient(typeof(ITransient1), typeof(Transient1))] +[Transient(typeof(ITransient2), typeof(Transient2))] +[Transient(typeof(ITransient3), typeof(Transient3))] +[Singleton(typeof(ISingleton1), typeof(Singleton1))] +[Singleton(typeof(ISingleton2), typeof(Singleton2))] +[Singleton(typeof(ISingleton3), typeof(Singleton3))] +internal partial class ContainerCombined +{ +} \ No newline at end of file From 8fadd9de006e0d8285027cca38d38e0e25f41225 Mon Sep 17 00:00:00 2001 From: Rafael Sliveira Cordeiro Date: Mon, 4 Dec 2023 23:45:36 -0800 Subject: [PATCH 02/16] Update Packages --- src/Jab.Performance/Jab.Performance.csproj | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Jab.Performance/Jab.Performance.csproj b/src/Jab.Performance/Jab.Performance.csproj index d48bfec..868915c 100644 --- a/src/Jab.Performance/Jab.Performance.csproj +++ b/src/Jab.Performance/Jab.Performance.csproj @@ -4,12 +4,14 @@ Exe net8.0 false + enable + enable - - - + + + From 1d9015db3e642c7795a1b352b28f9dc65f762762 Mon Sep 17 00:00:00 2001 From: Rafael Sliveira Cordeiro Date: Fri, 8 Dec 2023 23:56:58 -0800 Subject: [PATCH 03/16] Fix MixedBenchmark --- src/Jab.Performance/Basic/04-Mixed/Classes.cs | 60 +++++++++---------- .../Basic/04-Mixed/MixedBenchmark.cs | 18 +++--- 2 files changed, 37 insertions(+), 41 deletions(-) diff --git a/src/Jab.Performance/Basic/04-Mixed/Classes.cs b/src/Jab.Performance/Basic/04-Mixed/Classes.cs index 2599bf3..3fadf84 100644 --- a/src/Jab.Performance/Basic/04-Mixed/Classes.cs +++ b/src/Jab.Performance/Basic/04-Mixed/Classes.cs @@ -1,4 +1,4 @@ -namespace Jab.Performance.Basic.Scoped; +namespace Jab.Performance.Basic.Mixed; using Jab.Performance.Basic.Singleton; using Jab.Performance.Basic.Transient; @@ -7,12 +7,10 @@ public interface IMix1 { void SayHi(); } - public interface IMix2 { void SayHi(); } - public interface IMix3 { void SayHi(); @@ -20,62 +18,60 @@ public interface IMix3 public class Mix1 : IMix1 { - private readonly ISingleton1 _first; - private readonly ITransient1 _second; - public Mix1(ISingleton1 first, ITransient1 second) + private readonly ISingleton1 _singleton1; + private readonly ITransient1 _transient1; + public Mix1(ISingleton1 singleton1, ITransient1 transient1) { - ArgumentNullException.ThrowIfNull(first); - ArgumentNullException.ThrowIfNull(second); - this._first = first; - this._second = second; + ArgumentNullException.ThrowIfNull(singleton1); + ArgumentNullException.ThrowIfNull(transient1); + this._singleton1 = singleton1; + this._transient1 = transient1; } public void SayHi() { Console.WriteLine($"Hello from Combined 1"); - this._first.SayHi(); - this._second.SayHi(); + this._singleton1.SayHi(); + this._transient1.SayHi(); } } - public class Mix2 : IMix2 { - private readonly ISingleton2 _first; - private readonly ITransient2 _second; - public Mix2(ISingleton2 first, ITransient2 second) + private readonly ISingleton2 _singleton2; + private readonly ITransient2 _transient2; + public Mix2(ISingleton2 singleton2, ITransient2 transient2) { - ArgumentNullException.ThrowIfNull(first); - ArgumentNullException.ThrowIfNull(second); - this._first = first; - this._second = second; + ArgumentNullException.ThrowIfNull(singleton2); + ArgumentNullException.ThrowIfNull(transient2); + this._singleton2 = singleton2; + this._transient2 = transient2; } public void SayHi() { Console.WriteLine($"Hello from Combined 2"); - this._first.SayHi(); - this._second.SayHi(); + this._singleton2.SayHi(); + this._transient2.SayHi(); } } - public class Mix3 : IMix3 { - private readonly ISingleton3 _first; - private readonly ITransient3 _second; - public Mix3(ISingleton3 first, ITransient3 second) + private readonly ISingleton3 _singleton3; + private readonly ITransient3 _transient3; + public Mix3(ISingleton3 singleton3, ITransient3 transient3) { - ArgumentNullException.ThrowIfNull(first); - ArgumentNullException.ThrowIfNull(second); - this._first = first; - this._second = second; + ArgumentNullException.ThrowIfNull(singleton3); + ArgumentNullException.ThrowIfNull(transient3); + this._singleton3 = singleton3; + this._transient3 = transient3; } public void SayHi() { Console.WriteLine($"Hello from Combined 3"); - this._first.SayHi(); - this._second.SayHi(); + this._singleton3.SayHi(); + this._transient3.SayHi(); } } diff --git a/src/Jab.Performance/Basic/04-Mixed/MixedBenchmark.cs b/src/Jab.Performance/Basic/04-Mixed/MixedBenchmark.cs index 01c2f6b..5af2499 100644 --- a/src/Jab.Performance/Basic/04-Mixed/MixedBenchmark.cs +++ b/src/Jab.Performance/Basic/04-Mixed/MixedBenchmark.cs @@ -1,4 +1,4 @@ -namespace Jab.Performance.Basic.Scoped; +namespace Jab.Performance.Basic.Mixed; using BenchmarkDotNet.Attributes; using Jab.Performance.Basic.Singleton; @@ -10,7 +10,7 @@ public class MixedBenchmark { private readonly MEDI.ServiceProvider _provider; - private readonly ContainerCombined _container = new(); + private readonly ContainerMixed _container = new(); public MixedBenchmark() { @@ -41,11 +41,11 @@ public void Jab() using var scope = _container.CreateScope(); if (NumbersOfClasses >= 1) - _container.GetService(); + scope.GetService(); if (NumbersOfClasses >= 2) - _container.GetService(); + scope.GetService(); if (NumbersOfClasses >= 3) - _container.GetService(); + scope.GetService(); } } @@ -57,11 +57,11 @@ public void MEDI() using var scope = _provider.CreateScope(); if (NumbersOfClasses >= 1) - _provider.GetService(); + scope.ServiceProvider.GetService(); if(NumbersOfClasses >= 2) - _provider.GetService(); + scope.ServiceProvider.GetService(); if (NumbersOfClasses >= 3) - _provider.GetService(); + scope.ServiceProvider.GetService(); } } } @@ -76,6 +76,6 @@ public void MEDI() [Singleton(typeof(ISingleton1), typeof(Singleton1))] [Singleton(typeof(ISingleton2), typeof(Singleton2))] [Singleton(typeof(ISingleton3), typeof(Singleton3))] -internal partial class ContainerCombined +internal partial class ContainerMixed { } \ No newline at end of file From 55fd77778a66171342d1c827bb3ec7c32870aa84 Mon Sep 17 00:00:00 2001 From: Rafael Sliveira Cordeiro Date: Mon, 11 Dec 2023 20:39:28 -0800 Subject: [PATCH 04/16] Add ComplexBenchmark --- .../Basic/05-Complex/Classes.cs | 194 ++++++++++++++++++ .../Basic/05-Complex/ComplexBenchmark.cs | 96 +++++++++ 2 files changed, 290 insertions(+) create mode 100644 src/Jab.Performance/Basic/05-Complex/Classes.cs create mode 100644 src/Jab.Performance/Basic/05-Complex/ComplexBenchmark.cs diff --git a/src/Jab.Performance/Basic/05-Complex/Classes.cs b/src/Jab.Performance/Basic/05-Complex/Classes.cs new file mode 100644 index 0000000..628deb9 --- /dev/null +++ b/src/Jab.Performance/Basic/05-Complex/Classes.cs @@ -0,0 +1,194 @@ +namespace Jab.Performance.Basic.Complex; + +using Jab.Performance.Basic.Mixed; +using Jab.Performance.Basic.Singleton; +using Jab.Performance.Basic.Transient; + +public interface IComplex1 +{ + void SayHi(); +} +public interface IComplex2 +{ + void SayHi(); +} +public interface IComplex3 +{ + void SayHi(); +} + +public interface IService1 +{ + void SayHi(); +} +public interface IService2 +{ + void SayHi(); +} +public interface IService3 +{ + void SayHi(); +} + +public class Service1(ITransient1 Transient1) : IService1 +{ + public void SayHi() + { + Transient1.SayHi(); + Console.WriteLine("Hello from Service 1"); + } +} +public class Service2(ITransient2 Transient2) : IService2 +{ + public void SayHi() + { + Transient2.SayHi(); + Console.WriteLine("Hello from Service 2"); + } +} +public class Service3(ITransient3 Transient3) : IService3 +{ + public void SayHi() + { + Transient3.SayHi(); + Console.WriteLine("Hello from Service 3"); + } +} + +public class Complex1 : IComplex1 +{ + private readonly IService1 _service1; + private readonly IService2 _service2; + private readonly IService3 _service3; + private readonly IMix1 _mix1; + private readonly IMix2 _mix2; + private readonly IMix3 _mix3; + private readonly ISingleton1 _singleton1; + private readonly ITransient1 _transient1; + + public Complex1(IService1 service1, IService2 service2, IService3 service3, IMix1 mix1, IMix2 mix2, IMix3 mix3, ISingleton1 singleton1, ITransient1 transient1) + { + ArgumentNullException.ThrowIfNull(service1); + ArgumentNullException.ThrowIfNull(service2); + ArgumentNullException.ThrowIfNull(service3); + ArgumentNullException.ThrowIfNull(mix1); + ArgumentNullException.ThrowIfNull(mix2); + ArgumentNullException.ThrowIfNull(mix3); + ArgumentNullException.ThrowIfNull(singleton1); + ArgumentNullException.ThrowIfNull(transient1); + + _service1 = service1; + _service2 = service2; + _service3 = service3; + _mix1 = mix1; + _mix2 = mix2; + _mix3 = mix3; + _singleton1 = singleton1; + _transient1 = transient1; + } + + public void SayHi() + { + Console.WriteLine($"Hello from Complex 1"); + this._service1.SayHi(); + this._service2.SayHi(); + this._service3.SayHi(); + this._mix1.SayHi(); + this._mix2.SayHi(); + this._mix3.SayHi(); + this._singleton1.SayHi(); + this._transient1.SayHi(); + } +} + +public class Complex2 : IComplex2 +{ + private readonly IService1 _service1; + private readonly IService2 _service2; + private readonly IService3 _service3; + private readonly IMix1 _mix1; + private readonly IMix2 _mix2; + private readonly IMix3 _mix3; + private readonly ISingleton2 _singleton2; + private readonly ITransient2 _transient2; + + public Complex2(IService1 service1, IService2 service2, IService3 service3, IMix1 mix1, IMix2 mix2, IMix3 mix3, ISingleton2 singleton2, ITransient2 transient2) + { + ArgumentNullException.ThrowIfNull(service1); + ArgumentNullException.ThrowIfNull(service2); + ArgumentNullException.ThrowIfNull(service3); + ArgumentNullException.ThrowIfNull(mix1); + ArgumentNullException.ThrowIfNull(mix2); + ArgumentNullException.ThrowIfNull(mix3); + ArgumentNullException.ThrowIfNull(singleton2); + ArgumentNullException.ThrowIfNull(transient2); + + _service1 = service1; + _service2 = service2; + _service3 = service3; + _mix1 = mix1; + _mix2 = mix2; + _mix3 = mix3; + _singleton2 = singleton2; + _transient2 = transient2; + } + + public void SayHi() + { + Console.WriteLine($"Hello from Complex 2"); + this._service1.SayHi(); + this._service2.SayHi(); + this._service3.SayHi(); + this._mix1.SayHi(); + this._mix2.SayHi(); + this._mix3.SayHi(); + this._singleton2.SayHi(); + this._transient2.SayHi(); + } +} + +public class Complex3 : IComplex3 +{ + private readonly IService1 _service1; + private readonly IService2 _service2; + private readonly IService3 _service3; + private readonly IMix1 _mix1; + private readonly IMix2 _mix2; + private readonly IMix3 _mix3; + private readonly ISingleton3 _singleton3; + private readonly ITransient3 _transient3; + + public Complex3(IService1 service1, IService2 service2, IService3 service3, IMix1 mix1, IMix2 mix2, IMix3 mix3, ISingleton3 singleton3, ITransient3 transient3) + { + ArgumentNullException.ThrowIfNull(service1); + ArgumentNullException.ThrowIfNull(service2); + ArgumentNullException.ThrowIfNull(service3); + ArgumentNullException.ThrowIfNull(mix1); + ArgumentNullException.ThrowIfNull(mix2); + ArgumentNullException.ThrowIfNull(mix3); + ArgumentNullException.ThrowIfNull(singleton3); + ArgumentNullException.ThrowIfNull(transient3); + + _service1 = service1; + _service2 = service2; + _service3 = service3; + _mix1 = mix1; + _mix2 = mix2; + _mix3 = mix3; + _singleton3 = singleton3; + _transient3 = transient3; + } + + public void SayHi() + { + Console.WriteLine($"Hello from Complex 3"); + this._service1.SayHi(); + this._service2.SayHi(); + this._service3.SayHi(); + this._mix1.SayHi(); + this._mix2.SayHi(); + this._mix3.SayHi(); + this._singleton3.SayHi(); + this._transient3.SayHi(); + } +} diff --git a/src/Jab.Performance/Basic/05-Complex/ComplexBenchmark.cs b/src/Jab.Performance/Basic/05-Complex/ComplexBenchmark.cs new file mode 100644 index 0000000..e46a390 --- /dev/null +++ b/src/Jab.Performance/Basic/05-Complex/ComplexBenchmark.cs @@ -0,0 +1,96 @@ +namespace Jab.Performance.Basic.Complex; + +using BenchmarkDotNet.Attributes; +using Jab.Performance.Basic.Mixed; +using Jab.Performance.Basic.Scoped; +using Jab.Performance.Basic.Singleton; +using Jab.Performance.Basic.Transient; +using Microsoft.Extensions.DependencyInjection; +using MEDI = Microsoft.Extensions.DependencyInjection; + + +[MemoryDiagnoser] +public class ComplexBenchmark +{ + private readonly MEDI.ServiceProvider _provider; + private readonly ContainerComplex _container = new(); + + public ComplexBenchmark() + { + var serviceCollection = new ServiceCollection(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + _provider = serviceCollection.BuildServiceProvider(); + } + + [Params(1, 10, 100)] + public int NumbersOfCalls { get; set; } + + [Params(1, 2, 3)] + public int NumbersOfClasses { get; set; } + + [Benchmark(Baseline = true)] + public void Jab() + { + for (var i = 0; i < NumbersOfCalls; i++) + { + using var scope = _container.CreateScope(); + + if (NumbersOfClasses >= 1) + scope.GetService(); + if (NumbersOfClasses >= 2) + scope.GetService(); + if (NumbersOfClasses >= 3) + scope.GetService(); + } + } + + [Benchmark] + public void MEDI() + { + for (var i = 0; i < NumbersOfCalls; i++) + { + using var scope = _provider.CreateScope(); + + if (NumbersOfClasses >= 1) + scope.ServiceProvider.GetService(); + if (NumbersOfClasses >= 2) + scope.ServiceProvider.GetService(); + if (NumbersOfClasses >= 3) + scope.ServiceProvider.GetService(); + } + } +} + +[ServiceProvider] +[Scoped(typeof(IComplex1), typeof(Complex1))] +[Scoped(typeof(IComplex2), typeof(Complex2))] +[Scoped(typeof(IComplex3), typeof(Complex3))] +[Transient(typeof(IService1), typeof(Service1))] +[Transient(typeof(IService2), typeof(Service2))] +[Transient(typeof(IService3), typeof(Service3))] +[Transient(typeof(IMix1), typeof(Mix1))] +[Transient(typeof(IMix2), typeof(Mix2))] +[Transient(typeof(IMix3), typeof(Mix3))] +[Transient(typeof(ITransient1), typeof(Transient1))] +[Transient(typeof(ITransient2), typeof(Transient2))] +[Transient(typeof(ITransient3), typeof(Transient3))] +[Singleton(typeof(ISingleton1), typeof(Singleton1))] +[Singleton(typeof(ISingleton2), typeof(Singleton2))] +[Singleton(typeof(ISingleton3), typeof(Singleton3))] +internal partial class ContainerComplex +{ +} \ No newline at end of file From 634140f5fb8f408d4afdfdba7f1e10da4576170d Mon Sep 17 00:00:00 2001 From: Rafael Sliveira Cordeiro Date: Mon, 11 Dec 2023 21:17:26 -0800 Subject: [PATCH 05/16] BugFix --- .../Basic/03-Scoped/ScopedBenchmark.cs | 12 ++++++------ src/Jab.Performance/Basic/04-Mixed/MixedBenchmark.cs | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Jab.Performance/Basic/03-Scoped/ScopedBenchmark.cs b/src/Jab.Performance/Basic/03-Scoped/ScopedBenchmark.cs index 6dcd10c..2e01868 100644 --- a/src/Jab.Performance/Basic/03-Scoped/ScopedBenchmark.cs +++ b/src/Jab.Performance/Basic/03-Scoped/ScopedBenchmark.cs @@ -34,11 +34,11 @@ public void Jab() using var scope = _container.CreateScope(); if (NumbersOfClasses >= 1) - _container.GetService(); + scope.GetService(); if (NumbersOfClasses >= 2) - _container.GetService(); + scope.GetService(); if (NumbersOfClasses >= 3) - _container.GetService(); + scope.GetService(); } } @@ -50,11 +50,11 @@ public void MEDI() using var scope = _provider.CreateScope(); if (NumbersOfClasses >= 1) - _provider.GetService(); + scope.ServiceProvider.GetService(); if(NumbersOfClasses >= 2) - _provider.GetService(); + scope.ServiceProvider.GetService(); if (NumbersOfClasses >= 3) - _provider.GetService(); + scope.ServiceProvider.GetService(); } } } diff --git a/src/Jab.Performance/Basic/04-Mixed/MixedBenchmark.cs b/src/Jab.Performance/Basic/04-Mixed/MixedBenchmark.cs index 5af2499..bc6bde9 100644 --- a/src/Jab.Performance/Basic/04-Mixed/MixedBenchmark.cs +++ b/src/Jab.Performance/Basic/04-Mixed/MixedBenchmark.cs @@ -1,4 +1,4 @@ -namespace Jab.Performance.Basic.Mixed; +namespace Jab.Performance.Basic.Mixed; using BenchmarkDotNet.Attributes; using Jab.Performance.Basic.Singleton; @@ -58,7 +58,7 @@ public void MEDI() if (NumbersOfClasses >= 1) scope.ServiceProvider.GetService(); - if(NumbersOfClasses >= 2) + if (NumbersOfClasses >= 2) scope.ServiceProvider.GetService(); if (NumbersOfClasses >= 3) scope.ServiceProvider.GetService(); From d0bac8de81326da4aabb252c53759225e01c49f4 Mon Sep 17 00:00:00 2001 From: Rafael Sliveira Cordeiro Date: Mon, 11 Dec 2023 21:17:38 -0800 Subject: [PATCH 06/16] Add Deep Benchmarks --- .../Deep/01-Singleton/Classes.cs | 1301 ++++++++++++++ .../01-Singleton/DeepSingletonBenchmark.cs | 261 +++ .../Deep/02-Transient/Classes.cs | 901 ++++++++++ .../02-Transient/DeepTransientBenchmark.cs | 259 +++ src/Jab.Performance/Deep/03-Scoped/Classes.cs | 902 ++++++++++ .../Deep/03-Scoped/DeepScopedBenchmark.cs | 263 +++ src/Jab.Performance/Deep/04-Mixed/Classes.cs | 1505 +++++++++++++++++ .../Deep/04-Mixed/DeepMixedBenchmark.cs | 667 ++++++++ 8 files changed, 6059 insertions(+) create mode 100644 src/Jab.Performance/Deep/01-Singleton/Classes.cs create mode 100644 src/Jab.Performance/Deep/01-Singleton/DeepSingletonBenchmark.cs create mode 100644 src/Jab.Performance/Deep/02-Transient/Classes.cs create mode 100644 src/Jab.Performance/Deep/02-Transient/DeepTransientBenchmark.cs create mode 100644 src/Jab.Performance/Deep/03-Scoped/Classes.cs create mode 100644 src/Jab.Performance/Deep/03-Scoped/DeepScopedBenchmark.cs create mode 100644 src/Jab.Performance/Deep/04-Mixed/Classes.cs create mode 100644 src/Jab.Performance/Deep/04-Mixed/DeepMixedBenchmark.cs diff --git a/src/Jab.Performance/Deep/01-Singleton/Classes.cs b/src/Jab.Performance/Deep/01-Singleton/Classes.cs new file mode 100644 index 0000000..45ec961 --- /dev/null +++ b/src/Jab.Performance/Deep/01-Singleton/Classes.cs @@ -0,0 +1,1301 @@ +namespace Jab.Performance.Deep.Singleton; + +public interface ISingleton1 +{ + void SayHi(); +} +public class Singleton1(ISingleton2 _singleton2) : ISingleton1 +{ + public void SayHi() + { + _singleton2.SayHi(); + Console.WriteLine("Hello from Singleton 1"); + } +} + +public interface ISingleton2 +{ + void SayHi(); +} +public class Singleton2(ISingleton3 _singleton3) : ISingleton2 +{ + public void SayHi() + { + _singleton3.SayHi(); + Console.WriteLine("Hello from Singleton 2"); + } +} + +public interface ISingleton3 +{ + void SayHi(); +} +public class Singleton3(ISingleton4 _singleton4) : ISingleton3 +{ + public void SayHi() + { + _singleton4.SayHi(); + Console.WriteLine("Hello from Singleton 3"); + } +} + +public interface ISingleton4 +{ + void SayHi(); +} +public class Singleton4(ISingleton5 _singleton5) : ISingleton4 +{ + public void SayHi() + { + _singleton5.SayHi(); + Console.WriteLine("Hello from Singleton 4"); + } +} + +public interface ISingleton5 +{ + void SayHi(); +} +public class Singleton5(ISingleton6 _singleton6) : ISingleton5 +{ + public void SayHi() + { + _singleton6.SayHi(); + Console.WriteLine("Hello from Singleton 5"); + } +} + +public interface ISingleton6 +{ + void SayHi(); +} +public class Singleton6(ISingleton7 _singleton7) : ISingleton6 +{ + public void SayHi() + { + _singleton7.SayHi(); + Console.WriteLine("Hello from Singleton 6"); + } +} + +public interface ISingleton7 +{ + void SayHi(); +} +public class Singleton7(ISingleton8 _singleton8) : ISingleton7 +{ + public void SayHi() + { + _singleton8.SayHi(); + Console.WriteLine("Hello from Singleton 7"); + } +} + +public interface ISingleton8 +{ + void SayHi(); +} +public class Singleton8(ISingleton9 _singleton9) : ISingleton8 +{ + public void SayHi() + { + _singleton9.SayHi(); + Console.WriteLine("Hello from Singleton 8"); + } +} + +public interface ISingleton9 +{ + void SayHi(); +} +public class Singleton9(ISingleton10 _singleton10) : ISingleton9 +{ + public void SayHi() + { + _singleton10.SayHi(); + Console.WriteLine("Hello from Singleton 9"); + } +} + +public interface ISingleton10 +{ + void SayHi(); +} +public class Singleton10(ISingleton11 _singleton11) : ISingleton10 +{ + public void SayHi() + { + _singleton11.SayHi(); + Console.WriteLine("Hello from Singleton 10"); + } +} + +public interface ISingleton11 +{ + void SayHi(); +} +public class Singleton11(ISingleton12 _singleton12) : ISingleton11 +{ + public void SayHi() + { + _singleton12.SayHi(); + Console.WriteLine("Hello from Singleton 11"); + } +} + +public interface ISingleton12 +{ + void SayHi(); +} +public class Singleton12(ISingleton13 _singleton13) : ISingleton12 +{ + public void SayHi() + { + _singleton13.SayHi(); + Console.WriteLine("Hello from Singleton 12"); + } +} + +public interface ISingleton13 +{ + void SayHi(); +} +public class Singleton13(ISingleton14 _singleton14) : ISingleton13 +{ + public void SayHi() + { + _singleton14.SayHi(); + Console.WriteLine("Hello from Singleton 13"); + } +} + +public interface ISingleton14 +{ + void SayHi(); +} +public class Singleton14(ISingleton15 _singleton15) : ISingleton14 +{ + public void SayHi() + { + _singleton15.SayHi(); + Console.WriteLine("Hello from Singleton 14"); + } +} + +public interface ISingleton15 +{ + void SayHi(); +} +public class Singleton15(ISingleton16 _singleton16) : ISingleton15 +{ + public void SayHi() + { + _singleton16.SayHi(); + Console.WriteLine("Hello from Singleton 15"); + } +} + +public interface ISingleton16 +{ + void SayHi(); +} +public class Singleton16(ISingleton17 _singleton17) : ISingleton16 +{ + public void SayHi() + { + _singleton17.SayHi(); + Console.WriteLine("Hello from Singleton 16"); + } +} + +public interface ISingleton17 +{ + void SayHi(); +} +public class Singleton17(ISingleton18 _singleton18) : ISingleton17 +{ + public void SayHi() + { + _singleton18.SayHi(); + Console.WriteLine("Hello from Singleton 17"); + } +} + +public interface ISingleton18 +{ + void SayHi(); +} +public class Singleton18(ISingleton19 _singleton19) : ISingleton18 +{ + public void SayHi() + { + _singleton19.SayHi(); + Console.WriteLine("Hello from Singleton 18"); + } +} + +public interface ISingleton19 +{ + void SayHi(); +} +public class Singleton19(ISingleton20 _singleton20) : ISingleton19 +{ + public void SayHi() + { + _singleton20.SayHi(); + Console.WriteLine("Hello from Singleton 19"); + } +} + +public interface ISingleton20 +{ + void SayHi(); +} +public class Singleton20(ISingleton21 _singleton21) : ISingleton20 +{ + public void SayHi() + { + _singleton21.SayHi(); + Console.WriteLine("Hello from Singleton 20"); + } +} + +public interface ISingleton21 +{ + void SayHi(); +} +public class Singleton21(ISingleton22 _singleton22) : ISingleton21 +{ + public void SayHi() + { + _singleton22.SayHi(); + Console.WriteLine("Hello from Singleton 21"); + } +} + +public interface ISingleton22 +{ + void SayHi(); +} +public class Singleton22(ISingleton23 _singleton23) : ISingleton22 +{ + public void SayHi() + { + _singleton23.SayHi(); + Console.WriteLine("Hello from Singleton 22"); + } +} + +public interface ISingleton23 +{ + void SayHi(); +} +public class Singleton23(ISingleton24 _singleton24) : ISingleton23 +{ + public void SayHi() + { + _singleton24.SayHi(); + Console.WriteLine("Hello from Singleton 23"); + } +} + +public interface ISingleton24 +{ + void SayHi(); +} +public class Singleton24(ISingleton25 _singleton25) : ISingleton24 +{ + public void SayHi() + { + _singleton25.SayHi(); + Console.WriteLine("Hello from Singleton 24"); + } +} + +public interface ISingleton25 +{ + void SayHi(); +} +public class Singleton25(ISingleton26 _singleton26) : ISingleton25 +{ + public void SayHi() + { + _singleton26.SayHi(); + Console.WriteLine("Hello from Singleton 25"); + } +} + +public interface ISingleton26 +{ + void SayHi(); +} +public class Singleton26(ISingleton27 _singleton27) : ISingleton26 +{ + public void SayHi() + { + _singleton27.SayHi(); + Console.WriteLine("Hello from Singleton 26"); + } +} + +public interface ISingleton27 +{ + void SayHi(); +} +public class Singleton27(ISingleton28 _singleton28) : ISingleton27 +{ + public void SayHi() + { + _singleton28.SayHi(); + Console.WriteLine("Hello from Singleton 27"); + } +} + +public interface ISingleton28 +{ + void SayHi(); +} +public class Singleton28(ISingleton29 _singleton29) : ISingleton28 +{ + public void SayHi() + { + _singleton29.SayHi(); + Console.WriteLine("Hello from Singleton 28"); + } +} + +public interface ISingleton29 +{ + void SayHi(); +} +public class Singleton29(ISingleton30 _singleton30) : ISingleton29 +{ + public void SayHi() + { + _singleton30.SayHi(); + Console.WriteLine("Hello from Singleton 29"); + } +} + +public interface ISingleton30 +{ + void SayHi(); +} +public class Singleton30(ISingleton31 _singleton31) : ISingleton30 +{ + public void SayHi() + { + _singleton31.SayHi(); + Console.WriteLine("Hello from Singleton 30"); + } +} + +public interface ISingleton31 +{ + void SayHi(); +} +public class Singleton31(ISingleton32 _singleton32) : ISingleton31 +{ + public void SayHi() + { + _singleton32.SayHi(); + Console.WriteLine("Hello from Singleton 31"); + } +} + +public interface ISingleton32 +{ + void SayHi(); +} +public class Singleton32(ISingleton33 _singleton33) : ISingleton32 +{ + public void SayHi() + { + _singleton33.SayHi(); + Console.WriteLine("Hello from Singleton 32"); + } +} + +public interface ISingleton33 +{ + void SayHi(); +} +public class Singleton33(ISingleton34 _singleton34) : ISingleton33 +{ + public void SayHi() + { + _singleton34.SayHi(); + Console.WriteLine("Hello from Singleton 33"); + } +} + +public interface ISingleton34 +{ + void SayHi(); +} +public class Singleton34(ISingleton35 _singleton35) : ISingleton34 +{ + public void SayHi() + { + _singleton35.SayHi(); + Console.WriteLine("Hello from Singleton 34"); + } +} + +public interface ISingleton35 +{ + void SayHi(); +} +public class Singleton35(ISingleton36 _singleton36) : ISingleton35 +{ + public void SayHi() + { + _singleton36.SayHi(); + Console.WriteLine("Hello from Singleton 35"); + } +} + +public interface ISingleton36 +{ + void SayHi(); +} +public class Singleton36(ISingleton37 _singleton37) : ISingleton36 +{ + public void SayHi() + { + _singleton37.SayHi(); + Console.WriteLine("Hello from Singleton 36"); + } +} + +public interface ISingleton37 +{ + void SayHi(); +} +public class Singleton37(ISingleton38 _singleton38) : ISingleton37 +{ + public void SayHi() + { + _singleton38.SayHi(); + Console.WriteLine("Hello from Singleton 37"); + } +} + +public interface ISingleton38 +{ + void SayHi(); +} +public class Singleton38(ISingleton39 _singleton39) : ISingleton38 +{ + public void SayHi() + { + _singleton39.SayHi(); + Console.WriteLine("Hello from Singleton 38"); + } +} + +public interface ISingleton39 +{ + void SayHi(); +} +public class Singleton39(ISingleton40 _singleton40) : ISingleton39 +{ + public void SayHi() + { + _singleton40.SayHi(); + Console.WriteLine("Hello from Singleton 39"); + } +} + +public interface ISingleton40 +{ + void SayHi(); +} +public class Singleton40(ISingleton41 _singleton41) : ISingleton40 +{ + public void SayHi() + { + _singleton41.SayHi(); + Console.WriteLine("Hello from Singleton 40"); + } +} + +public interface ISingleton41 +{ + void SayHi(); +} +public class Singleton41(ISingleton42 _singleton42) : ISingleton41 +{ + public void SayHi() + { + _singleton42.SayHi(); + Console.WriteLine("Hello from Singleton 41"); + } +} + +public interface ISingleton42 +{ + void SayHi(); +} +public class Singleton42(ISingleton43 _singleton43) : ISingleton42 +{ + public void SayHi() + { + _singleton43.SayHi(); + Console.WriteLine("Hello from Singleton 42"); + } +} + +public interface ISingleton43 +{ + void SayHi(); +} +public class Singleton43(ISingleton44 _singleton44) : ISingleton43 +{ + public void SayHi() + { + _singleton44.SayHi(); + Console.WriteLine("Hello from Singleton 43"); + } +} + +public interface ISingleton44 +{ + void SayHi(); +} +public class Singleton44(ISingleton45 _singleton45) : ISingleton44 +{ + public void SayHi() + { + _singleton45.SayHi(); + Console.WriteLine("Hello from Singleton 44"); + } +} + +public interface ISingleton45 +{ + void SayHi(); +} +public class Singleton45(ISingleton46 _singleton46) : ISingleton45 +{ + public void SayHi() + { + _singleton46.SayHi(); + Console.WriteLine("Hello from Singleton 45"); + } +} + +public interface ISingleton46 +{ + void SayHi(); +} +public class Singleton46(ISingleton47 _singleton47) : ISingleton46 +{ + public void SayHi() + { + _singleton47.SayHi(); + Console.WriteLine("Hello from Singleton 46"); + } +} + +public interface ISingleton47 +{ + void SayHi(); +} +public class Singleton47(ISingleton48 _singleton48) : ISingleton47 +{ + public void SayHi() + { + _singleton48.SayHi(); + Console.WriteLine("Hello from Singleton 47"); + } +} + +public interface ISingleton48 +{ + void SayHi(); +} +public class Singleton48(ISingleton49 _singleton49) : ISingleton48 +{ + public void SayHi() + { + _singleton49.SayHi(); + Console.WriteLine("Hello from Singleton 48"); + } +} + +public interface ISingleton49 +{ + void SayHi(); +} +public class Singleton49(ISingleton50 _singleton50) : ISingleton49 +{ + public void SayHi() + { + _singleton50.SayHi(); + Console.WriteLine("Hello from Singleton 49"); + } +} + +public interface ISingleton50 +{ + void SayHi(); +} +public class Singleton50(ISingleton51 _singleton51) : ISingleton50 +{ + public void SayHi() + { + _singleton51.SayHi(); + Console.WriteLine("Hello from Singleton 50"); + } +} + +public interface ISingleton51 +{ + void SayHi(); +} +public class Singleton51(ISingleton52 _singleton52) : ISingleton51 +{ + public void SayHi() + { + _singleton52.SayHi(); + Console.WriteLine("Hello from Singleton 51"); + } +} + +public interface ISingleton52 +{ + void SayHi(); +} +public class Singleton52(ISingleton53 _singleton53) : ISingleton52 +{ + public void SayHi() + { + _singleton53.SayHi(); + Console.WriteLine("Hello from Singleton 52"); + } +} + +public interface ISingleton53 +{ + void SayHi(); +} +public class Singleton53(ISingleton54 _singleton54) : ISingleton53 +{ + public void SayHi() + { + _singleton54.SayHi(); + Console.WriteLine("Hello from Singleton 53"); + } +} + +public interface ISingleton54 +{ + void SayHi(); +} +public class Singleton54(ISingleton55 _singleton55) : ISingleton54 +{ + public void SayHi() + { + _singleton55.SayHi(); + Console.WriteLine("Hello from Singleton 54"); + } +} + +public interface ISingleton55 +{ + void SayHi(); +} +public class Singleton55(ISingleton56 _singleton56) : ISingleton55 +{ + public void SayHi() + { + _singleton56.SayHi(); + Console.WriteLine("Hello from Singleton 55"); + } +} + +public interface ISingleton56 +{ + void SayHi(); +} +public class Singleton56(ISingleton57 _singleton57) : ISingleton56 +{ + public void SayHi() + { + _singleton57.SayHi(); + Console.WriteLine("Hello from Singleton 56"); + } +} + +public interface ISingleton57 +{ + void SayHi(); +} +public class Singleton57(ISingleton58 _singleton58) : ISingleton57 +{ + public void SayHi() + { + _singleton58.SayHi(); + Console.WriteLine("Hello from Singleton 57"); + } +} + +public interface ISingleton58 +{ + void SayHi(); +} +public class Singleton58(ISingleton59 _singleton59) : ISingleton58 +{ + public void SayHi() + { + _singleton59.SayHi(); + Console.WriteLine("Hello from Singleton 58"); + } +} + +public interface ISingleton59 +{ + void SayHi(); +} +public class Singleton59(ISingleton60 _singleton60) : ISingleton59 +{ + public void SayHi() + { + _singleton60.SayHi(); + Console.WriteLine("Hello from Singleton 59"); + } +} + +public interface ISingleton60 +{ + void SayHi(); +} +public class Singleton60(ISingleton61 _singleton61) : ISingleton60 +{ + public void SayHi() + { + _singleton61.SayHi(); + Console.WriteLine("Hello from Singleton 60"); + } +} + +public interface ISingleton61 +{ + void SayHi(); +} +public class Singleton61(ISingleton62 _singleton62) : ISingleton61 +{ + public void SayHi() + { + _singleton62.SayHi(); + Console.WriteLine("Hello from Singleton 61"); + } +} + +public interface ISingleton62 +{ + void SayHi(); +} +public class Singleton62(ISingleton63 _singleton63) : ISingleton62 +{ + public void SayHi() + { + _singleton63.SayHi(); + Console.WriteLine("Hello from Singleton 62"); + } +} + +public interface ISingleton63 +{ + void SayHi(); +} +public class Singleton63(ISingleton64 _singleton64) : ISingleton63 +{ + public void SayHi() + { + _singleton64.SayHi(); + Console.WriteLine("Hello from Singleton 63"); + } +} + +public interface ISingleton64 +{ + void SayHi(); +} +public class Singleton64(ISingleton65 _singleton65) : ISingleton64 +{ + public void SayHi() + { + _singleton65.SayHi(); + Console.WriteLine("Hello from Singleton 64"); + } +} + +public interface ISingleton65 +{ + void SayHi(); +} +public class Singleton65(ISingleton66 _singleton66) : ISingleton65 +{ + public void SayHi() + { + _singleton66.SayHi(); + Console.WriteLine("Hello from Singleton 65"); + } +} + +public interface ISingleton66 +{ + void SayHi(); +} +public class Singleton66(ISingleton67 _singleton67) : ISingleton66 +{ + public void SayHi() + { + _singleton67.SayHi(); + Console.WriteLine("Hello from Singleton 66"); + } +} + +public interface ISingleton67 +{ + void SayHi(); +} +public class Singleton67(ISingleton68 _singleton68) : ISingleton67 +{ + public void SayHi() + { + _singleton68.SayHi(); + Console.WriteLine("Hello from Singleton 67"); + } +} + +public interface ISingleton68 +{ + void SayHi(); +} +public class Singleton68(ISingleton69 _singleton69) : ISingleton68 +{ + public void SayHi() + { + _singleton69.SayHi(); + Console.WriteLine("Hello from Singleton 68"); + } +} + +public interface ISingleton69 +{ + void SayHi(); +} +public class Singleton69(ISingleton70 _singleton70) : ISingleton69 +{ + public void SayHi() + { + _singleton70.SayHi(); + Console.WriteLine("Hello from Singleton 69"); + } +} + +public interface ISingleton70 +{ + void SayHi(); +} +public class Singleton70(ISingleton71 _singleton71) : ISingleton70 +{ + public void SayHi() + { + _singleton71.SayHi(); + Console.WriteLine("Hello from Singleton 70"); + } +} + +public interface ISingleton71 +{ + void SayHi(); +} +public class Singleton71(ISingleton72 _singleton72) : ISingleton71 +{ + public void SayHi() + { + _singleton72.SayHi(); + Console.WriteLine("Hello from Singleton 71"); + } +} + +public interface ISingleton72 +{ + void SayHi(); +} +public class Singleton72(ISingleton73 _singleton73) : ISingleton72 +{ + public void SayHi() + { + _singleton73.SayHi(); + Console.WriteLine("Hello from Singleton 72"); + } +} + +public interface ISingleton73 +{ + void SayHi(); +} +public class Singleton73(ISingleton74 _singleton74) : ISingleton73 +{ + public void SayHi() + { + _singleton74.SayHi(); + Console.WriteLine("Hello from Singleton 73"); + } +} + +public interface ISingleton74 +{ + void SayHi(); +} +public class Singleton74(ISingleton75 _singleton75) : ISingleton74 +{ + public void SayHi() + { + _singleton75.SayHi(); + Console.WriteLine("Hello from Singleton 74"); + } +} + +public interface ISingleton75 +{ + void SayHi(); +} +public class Singleton75(ISingleton76 _singleton76) : ISingleton75 +{ + public void SayHi() + { + _singleton76.SayHi(); + Console.WriteLine("Hello from Singleton 75"); + } +} + +public interface ISingleton76 +{ + void SayHi(); +} +public class Singleton76(ISingleton77 _singleton77) : ISingleton76 +{ + public void SayHi() + { + _singleton77.SayHi(); + Console.WriteLine("Hello from Singleton 76"); + } +} + +public interface ISingleton77 +{ + void SayHi(); +} +public class Singleton77(ISingleton78 _singleton78) : ISingleton77 +{ + public void SayHi() + { + _singleton78.SayHi(); + Console.WriteLine("Hello from Singleton 77"); + } +} + +public interface ISingleton78 +{ + void SayHi(); +} +public class Singleton78(ISingleton79 _singleton79) : ISingleton78 +{ + public void SayHi() + { + _singleton79.SayHi(); + Console.WriteLine("Hello from Singleton 78"); + } +} + +public interface ISingleton79 +{ + void SayHi(); +} +public class Singleton79(ISingleton80 _singleton80) : ISingleton79 +{ + public void SayHi() + { + _singleton80.SayHi(); + Console.WriteLine("Hello from Singleton 79"); + } +} + +public interface ISingleton80 +{ + void SayHi(); +} +public class Singleton80(ISingleton81 _singleton81) : ISingleton80 +{ + public void SayHi() + { + _singleton81.SayHi(); + Console.WriteLine("Hello from Singleton 80"); + } +} + +public interface ISingleton81 +{ + void SayHi(); +} +public class Singleton81(ISingleton82 _singleton82) : ISingleton81 +{ + public void SayHi() + { + _singleton82.SayHi(); + Console.WriteLine("Hello from Singleton 81"); + } +} + +public interface ISingleton82 +{ + void SayHi(); +} +public class Singleton82(ISingleton83 _singleton83) : ISingleton82 +{ + public void SayHi() + { + _singleton83.SayHi(); + Console.WriteLine("Hello from Singleton 82"); + } +} + +public interface ISingleton83 +{ + void SayHi(); +} +public class Singleton83(ISingleton84 _singleton84) : ISingleton83 +{ + public void SayHi() + { + _singleton84.SayHi(); + Console.WriteLine("Hello from Singleton 83"); + } +} + +public interface ISingleton84 +{ + void SayHi(); +} +public class Singleton84(ISingleton85 _singleton85) : ISingleton84 +{ + public void SayHi() + { + _singleton85.SayHi(); + Console.WriteLine("Hello from Singleton 84"); + } +} + +public interface ISingleton85 +{ + void SayHi(); +} +public class Singleton85(ISingleton86 _singleton86) : ISingleton85 +{ + public void SayHi() + { + _singleton86.SayHi(); + Console.WriteLine("Hello from Singleton 85"); + } +} + +public interface ISingleton86 +{ + void SayHi(); +} +public class Singleton86(ISingleton87 _singleton87) : ISingleton86 +{ + public void SayHi() + { + _singleton87.SayHi(); + Console.WriteLine("Hello from Singleton 86"); + } +} + +public interface ISingleton87 +{ + void SayHi(); +} +public class Singleton87(ISingleton88 _singleton88) : ISingleton87 +{ + public void SayHi() + { + _singleton88.SayHi(); + Console.WriteLine("Hello from Singleton 87"); + } +} + +public interface ISingleton88 +{ + void SayHi(); +} +public class Singleton88(ISingleton89 _singleton89) : ISingleton88 +{ + public void SayHi() + { + _singleton89.SayHi(); + Console.WriteLine("Hello from Singleton 88"); + } +} + +public interface ISingleton89 +{ + void SayHi(); +} +public class Singleton89(ISingleton90 _singleton90) : ISingleton89 +{ + public void SayHi() + { + _singleton90.SayHi(); + Console.WriteLine("Hello from Singleton 89"); + } +} + +public interface ISingleton90 +{ + void SayHi(); +} +public class Singleton90(ISingleton91 _singleton91) : ISingleton90 +{ + public void SayHi() + { + _singleton91.SayHi(); + Console.WriteLine("Hello from Singleton 90"); + } +} + +public interface ISingleton91 +{ + void SayHi(); +} +public class Singleton91(ISingleton92 _singleton92) : ISingleton91 +{ + public void SayHi() + { + _singleton92.SayHi(); + Console.WriteLine("Hello from Singleton 91"); + } +} + +public interface ISingleton92 +{ + void SayHi(); +} +public class Singleton92(ISingleton93 _singleton93) : ISingleton92 +{ + public void SayHi() + { + _singleton93.SayHi(); + Console.WriteLine("Hello from Singleton 92"); + } +} + +public interface ISingleton93 +{ + void SayHi(); +} +public class Singleton93(ISingleton94 _singleton94) : ISingleton93 +{ + public void SayHi() + { + _singleton94.SayHi(); + Console.WriteLine("Hello from Singleton 93"); + } +} + +public interface ISingleton94 +{ + void SayHi(); +} +public class Singleton94(ISingleton95 _singleton95) : ISingleton94 +{ + public void SayHi() + { + _singleton95.SayHi(); + Console.WriteLine("Hello from Singleton 94"); + } +} + +public interface ISingleton95 +{ + void SayHi(); +} +public class Singleton95(ISingleton96 _singleton96) : ISingleton95 +{ + public void SayHi() + { + _singleton96.SayHi(); + Console.WriteLine("Hello from Singleton 95"); + } +} + +public interface ISingleton96 +{ + void SayHi(); +} +public class Singleton96(ISingleton97 _singleton97) : ISingleton96 +{ + public void SayHi() + { + _singleton97.SayHi(); + Console.WriteLine("Hello from Singleton 96"); + } +} + +public interface ISingleton97 +{ + void SayHi(); +} +public class Singleton97(ISingleton98 _singleton98) : ISingleton97 +{ + public void SayHi() + { + _singleton98.SayHi(); + Console.WriteLine("Hello from Singleton 97"); + } +} + +public interface ISingleton98 +{ + void SayHi(); +} +public class Singleton98(ISingleton99 _singleton99) : ISingleton98 +{ + public void SayHi() + { + _singleton99.SayHi(); + Console.WriteLine("Hello from Singleton 98"); + } +} + +public interface ISingleton99 +{ + void SayHi(); +} +public class Singleton99(ISingleton100 _singleton100) : ISingleton99 +{ + public void SayHi() + { + _singleton100.SayHi(); + Console.WriteLine("Hello from Singleton 99"); + } +} + +public interface ISingleton100 +{ + void SayHi(); +} +public class Singleton100() : ISingleton100 +{ + public void SayHi() + { + Console.WriteLine("Hello from Singleton 100"); + } +} + diff --git a/src/Jab.Performance/Deep/01-Singleton/DeepSingletonBenchmark.cs b/src/Jab.Performance/Deep/01-Singleton/DeepSingletonBenchmark.cs new file mode 100644 index 0000000..359f52f --- /dev/null +++ b/src/Jab.Performance/Deep/01-Singleton/DeepSingletonBenchmark.cs @@ -0,0 +1,261 @@ +namespace Jab.Performance.Deep.Singleton; + +using BenchmarkDotNet.Attributes; +using Jab.Performance.Basic.Mixed; +using Microsoft.Extensions.DependencyInjection; +using static System.Formats.Asn1.AsnWriter; +using MEDI = Microsoft.Extensions.DependencyInjection; + + +[MemoryDiagnoser] +public class DeepSingletonBenchmark +{ + private readonly MEDI.ServiceProvider _provider; + private readonly DeepContainerSingleton _container = new(); + + public DeepSingletonBenchmark() + { + var serviceCollection = new ServiceCollection(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + + _provider = serviceCollection.BuildServiceProvider(); + } + + [Params(1, 10, 100)] + public int NumbersOfCalls { get; set; } + + [Params(1, 10, 100)] + public int Deep { get; set; } + + [Benchmark(Baseline = true)] + public void Jab() + { + for (var i = 0; i < NumbersOfCalls; i++) + { + if (Deep == 1 ) + _container.GetService(); + if (Deep == 10) + _container.GetService(); + if (Deep == 100) + _container.GetService(); + } + } + + [Benchmark] + public void MEDI() + { + for (var i = 0; i < NumbersOfCalls; i++) + { + if (Deep == 1) + _provider.GetService(); + if (Deep == 10) + _provider.GetService(); + if (Deep == 100) + _provider.GetService(); + } + } +} + +[ServiceProvider] +[Singleton(typeof(ISingleton1), typeof(Singleton1))] +[Singleton(typeof(ISingleton2), typeof(Singleton2))] +[Singleton(typeof(ISingleton3), typeof(Singleton3))] +[Singleton(typeof(ISingleton4), typeof(Singleton4))] +[Singleton(typeof(ISingleton5), typeof(Singleton5))] +[Singleton(typeof(ISingleton6), typeof(Singleton6))] +[Singleton(typeof(ISingleton7), typeof(Singleton7))] +[Singleton(typeof(ISingleton8), typeof(Singleton8))] +[Singleton(typeof(ISingleton9), typeof(Singleton9))] +[Singleton(typeof(ISingleton10), typeof(Singleton10))] +[Singleton(typeof(ISingleton11), typeof(Singleton11))] +[Singleton(typeof(ISingleton12), typeof(Singleton12))] +[Singleton(typeof(ISingleton13), typeof(Singleton13))] +[Singleton(typeof(ISingleton14), typeof(Singleton14))] +[Singleton(typeof(ISingleton15), typeof(Singleton15))] +[Singleton(typeof(ISingleton16), typeof(Singleton16))] +[Singleton(typeof(ISingleton17), typeof(Singleton17))] +[Singleton(typeof(ISingleton18), typeof(Singleton18))] +[Singleton(typeof(ISingleton19), typeof(Singleton19))] +[Singleton(typeof(ISingleton20), typeof(Singleton20))] +[Singleton(typeof(ISingleton21), typeof(Singleton21))] +[Singleton(typeof(ISingleton22), typeof(Singleton22))] +[Singleton(typeof(ISingleton23), typeof(Singleton23))] +[Singleton(typeof(ISingleton24), typeof(Singleton24))] +[Singleton(typeof(ISingleton25), typeof(Singleton25))] +[Singleton(typeof(ISingleton26), typeof(Singleton26))] +[Singleton(typeof(ISingleton27), typeof(Singleton27))] +[Singleton(typeof(ISingleton28), typeof(Singleton28))] +[Singleton(typeof(ISingleton29), typeof(Singleton29))] +[Singleton(typeof(ISingleton30), typeof(Singleton30))] +[Singleton(typeof(ISingleton31), typeof(Singleton31))] +[Singleton(typeof(ISingleton32), typeof(Singleton32))] +[Singleton(typeof(ISingleton33), typeof(Singleton33))] +[Singleton(typeof(ISingleton34), typeof(Singleton34))] +[Singleton(typeof(ISingleton35), typeof(Singleton35))] +[Singleton(typeof(ISingleton36), typeof(Singleton36))] +[Singleton(typeof(ISingleton37), typeof(Singleton37))] +[Singleton(typeof(ISingleton38), typeof(Singleton38))] +[Singleton(typeof(ISingleton39), typeof(Singleton39))] +[Singleton(typeof(ISingleton40), typeof(Singleton40))] +[Singleton(typeof(ISingleton41), typeof(Singleton41))] +[Singleton(typeof(ISingleton42), typeof(Singleton42))] +[Singleton(typeof(ISingleton43), typeof(Singleton43))] +[Singleton(typeof(ISingleton44), typeof(Singleton44))] +[Singleton(typeof(ISingleton45), typeof(Singleton45))] +[Singleton(typeof(ISingleton46), typeof(Singleton46))] +[Singleton(typeof(ISingleton47), typeof(Singleton47))] +[Singleton(typeof(ISingleton48), typeof(Singleton48))] +[Singleton(typeof(ISingleton49), typeof(Singleton49))] +[Singleton(typeof(ISingleton50), typeof(Singleton50))] +[Singleton(typeof(ISingleton51), typeof(Singleton51))] +[Singleton(typeof(ISingleton52), typeof(Singleton52))] +[Singleton(typeof(ISingleton53), typeof(Singleton53))] +[Singleton(typeof(ISingleton54), typeof(Singleton54))] +[Singleton(typeof(ISingleton55), typeof(Singleton55))] +[Singleton(typeof(ISingleton56), typeof(Singleton56))] +[Singleton(typeof(ISingleton57), typeof(Singleton57))] +[Singleton(typeof(ISingleton58), typeof(Singleton58))] +[Singleton(typeof(ISingleton59), typeof(Singleton59))] +[Singleton(typeof(ISingleton60), typeof(Singleton60))] +[Singleton(typeof(ISingleton61), typeof(Singleton61))] +[Singleton(typeof(ISingleton62), typeof(Singleton62))] +[Singleton(typeof(ISingleton63), typeof(Singleton63))] +[Singleton(typeof(ISingleton64), typeof(Singleton64))] +[Singleton(typeof(ISingleton65), typeof(Singleton65))] +[Singleton(typeof(ISingleton66), typeof(Singleton66))] +[Singleton(typeof(ISingleton67), typeof(Singleton67))] +[Singleton(typeof(ISingleton68), typeof(Singleton68))] +[Singleton(typeof(ISingleton69), typeof(Singleton69))] +[Singleton(typeof(ISingleton70), typeof(Singleton70))] +[Singleton(typeof(ISingleton71), typeof(Singleton71))] +[Singleton(typeof(ISingleton72), typeof(Singleton72))] +[Singleton(typeof(ISingleton73), typeof(Singleton73))] +[Singleton(typeof(ISingleton74), typeof(Singleton74))] +[Singleton(typeof(ISingleton75), typeof(Singleton75))] +[Singleton(typeof(ISingleton76), typeof(Singleton76))] +[Singleton(typeof(ISingleton77), typeof(Singleton77))] +[Singleton(typeof(ISingleton78), typeof(Singleton78))] +[Singleton(typeof(ISingleton79), typeof(Singleton79))] +[Singleton(typeof(ISingleton80), typeof(Singleton80))] +[Singleton(typeof(ISingleton81), typeof(Singleton81))] +[Singleton(typeof(ISingleton82), typeof(Singleton82))] +[Singleton(typeof(ISingleton83), typeof(Singleton83))] +[Singleton(typeof(ISingleton84), typeof(Singleton84))] +[Singleton(typeof(ISingleton85), typeof(Singleton85))] +[Singleton(typeof(ISingleton86), typeof(Singleton86))] +[Singleton(typeof(ISingleton87), typeof(Singleton87))] +[Singleton(typeof(ISingleton88), typeof(Singleton88))] +[Singleton(typeof(ISingleton89), typeof(Singleton89))] +[Singleton(typeof(ISingleton90), typeof(Singleton90))] +[Singleton(typeof(ISingleton91), typeof(Singleton91))] +[Singleton(typeof(ISingleton92), typeof(Singleton92))] +[Singleton(typeof(ISingleton93), typeof(Singleton93))] +[Singleton(typeof(ISingleton94), typeof(Singleton94))] +[Singleton(typeof(ISingleton95), typeof(Singleton95))] +[Singleton(typeof(ISingleton96), typeof(Singleton96))] +[Singleton(typeof(ISingleton97), typeof(Singleton97))] +[Singleton(typeof(ISingleton98), typeof(Singleton98))] +[Singleton(typeof(ISingleton99), typeof(Singleton99))] +[Singleton(typeof(ISingleton100), typeof(Singleton100))] +internal partial class DeepContainerSingleton +{ +} \ No newline at end of file diff --git a/src/Jab.Performance/Deep/02-Transient/Classes.cs b/src/Jab.Performance/Deep/02-Transient/Classes.cs new file mode 100644 index 0000000..e16af55 --- /dev/null +++ b/src/Jab.Performance/Deep/02-Transient/Classes.cs @@ -0,0 +1,901 @@ +namespace Jab.Performance.Deep.Transient; + +public interface ITransient1 +{ + void SayHi(); +} +public class Transient1() : ITransient1 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 1"); +} + +public interface ITransient2 +{ + void SayHi(); +} +public class Transient2() : ITransient2 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 2"); +} + +public interface ITransient3 +{ + void SayHi(); +} +public class Transient3() : ITransient3 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 3"); +} + +public interface ITransient4 +{ + void SayHi(); +} +public class Transient4() : ITransient4 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 4"); +} + +public interface ITransient5 +{ + void SayHi(); +} +public class Transient5() : ITransient5 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 5"); +} + +public interface ITransient6 +{ + void SayHi(); +} +public class Transient6() : ITransient6 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 6"); +} + +public interface ITransient7 +{ + void SayHi(); +} +public class Transient7() : ITransient7 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 7"); +} + +public interface ITransient8 +{ + void SayHi(); +} +public class Transient8() : ITransient8 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 8"); +} + +public interface ITransient9 +{ + void SayHi(); +} +public class Transient9() : ITransient9 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 9"); +} + +public interface ITransient10 +{ + void SayHi(); +} +public class Transient10() : ITransient10 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 10"); +} + +public interface ITransient11 +{ + void SayHi(); +} +public class Transient11() : ITransient11 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 11"); +} + +public interface ITransient12 +{ + void SayHi(); +} +public class Transient12() : ITransient12 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 12"); +} + +public interface ITransient13 +{ + void SayHi(); +} +public class Transient13() : ITransient13 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 13"); +} + +public interface ITransient14 +{ + void SayHi(); +} +public class Transient14() : ITransient14 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 14"); +} + +public interface ITransient15 +{ + void SayHi(); +} +public class Transient15() : ITransient15 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 15"); +} + +public interface ITransient16 +{ + void SayHi(); +} +public class Transient16() : ITransient16 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 16"); +} + +public interface ITransient17 +{ + void SayHi(); +} +public class Transient17() : ITransient17 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 17"); +} + +public interface ITransient18 +{ + void SayHi(); +} +public class Transient18() : ITransient18 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 18"); +} + +public interface ITransient19 +{ + void SayHi(); +} +public class Transient19() : ITransient19 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 19"); +} + +public interface ITransient20 +{ + void SayHi(); +} +public class Transient20() : ITransient20 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 20"); +} + +public interface ITransient21 +{ + void SayHi(); +} +public class Transient21() : ITransient21 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 21"); +} + +public interface ITransient22 +{ + void SayHi(); +} +public class Transient22() : ITransient22 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 22"); +} + +public interface ITransient23 +{ + void SayHi(); +} +public class Transient23() : ITransient23 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 23"); +} + +public interface ITransient24 +{ + void SayHi(); +} +public class Transient24() : ITransient24 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 24"); +} + +public interface ITransient25 +{ + void SayHi(); +} +public class Transient25() : ITransient25 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 25"); +} + +public interface ITransient26 +{ + void SayHi(); +} +public class Transient26() : ITransient26 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 26"); +} + +public interface ITransient27 +{ + void SayHi(); +} +public class Transient27() : ITransient27 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 27"); +} + +public interface ITransient28 +{ + void SayHi(); +} +public class Transient28() : ITransient28 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 28"); +} + +public interface ITransient29 +{ + void SayHi(); +} +public class Transient29() : ITransient29 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 29"); +} + +public interface ITransient30 +{ + void SayHi(); +} +public class Transient30() : ITransient30 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 30"); +} + +public interface ITransient31 +{ + void SayHi(); +} +public class Transient31() : ITransient31 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 31"); +} + +public interface ITransient32 +{ + void SayHi(); +} +public class Transient32() : ITransient32 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 32"); +} + +public interface ITransient33 +{ + void SayHi(); +} +public class Transient33() : ITransient33 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 33"); +} + +public interface ITransient34 +{ + void SayHi(); +} +public class Transient34() : ITransient34 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 34"); +} + +public interface ITransient35 +{ + void SayHi(); +} +public class Transient35() : ITransient35 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 35"); +} + +public interface ITransient36 +{ + void SayHi(); +} +public class Transient36() : ITransient36 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 36"); +} + +public interface ITransient37 +{ + void SayHi(); +} +public class Transient37() : ITransient37 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 37"); +} + +public interface ITransient38 +{ + void SayHi(); +} +public class Transient38() : ITransient38 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 38"); +} + +public interface ITransient39 +{ + void SayHi(); +} +public class Transient39() : ITransient39 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 39"); +} + +public interface ITransient40 +{ + void SayHi(); +} +public class Transient40() : ITransient40 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 40"); +} + +public interface ITransient41 +{ + void SayHi(); +} +public class Transient41() : ITransient41 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 41"); +} + +public interface ITransient42 +{ + void SayHi(); +} +public class Transient42() : ITransient42 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 42"); +} + +public interface ITransient43 +{ + void SayHi(); +} +public class Transient43() : ITransient43 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 43"); +} + +public interface ITransient44 +{ + void SayHi(); +} +public class Transient44() : ITransient44 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 44"); +} + +public interface ITransient45 +{ + void SayHi(); +} +public class Transient45() : ITransient45 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 45"); +} + +public interface ITransient46 +{ + void SayHi(); +} +public class Transient46() : ITransient46 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 46"); +} + +public interface ITransient47 +{ + void SayHi(); +} +public class Transient47() : ITransient47 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 47"); +} + +public interface ITransient48 +{ + void SayHi(); +} +public class Transient48() : ITransient48 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 48"); +} + +public interface ITransient49 +{ + void SayHi(); +} +public class Transient49() : ITransient49 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 49"); +} + +public interface ITransient50 +{ + void SayHi(); +} +public class Transient50() : ITransient50 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 50"); +} + +public interface ITransient51 +{ + void SayHi(); +} +public class Transient51() : ITransient51 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 51"); +} + +public interface ITransient52 +{ + void SayHi(); +} +public class Transient52() : ITransient52 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 52"); +} + +public interface ITransient53 +{ + void SayHi(); +} +public class Transient53() : ITransient53 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 53"); +} + +public interface ITransient54 +{ + void SayHi(); +} +public class Transient54() : ITransient54 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 54"); +} + +public interface ITransient55 +{ + void SayHi(); +} +public class Transient55() : ITransient55 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 55"); +} + +public interface ITransient56 +{ + void SayHi(); +} +public class Transient56() : ITransient56 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 56"); +} + +public interface ITransient57 +{ + void SayHi(); +} +public class Transient57() : ITransient57 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 57"); +} + +public interface ITransient58 +{ + void SayHi(); +} +public class Transient58() : ITransient58 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 58"); +} + +public interface ITransient59 +{ + void SayHi(); +} +public class Transient59() : ITransient59 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 59"); +} + +public interface ITransient60 +{ + void SayHi(); +} +public class Transient60() : ITransient60 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 60"); +} + +public interface ITransient61 +{ + void SayHi(); +} +public class Transient61() : ITransient61 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 61"); +} + +public interface ITransient62 +{ + void SayHi(); +} +public class Transient62() : ITransient62 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 62"); +} + +public interface ITransient63 +{ + void SayHi(); +} +public class Transient63() : ITransient63 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 63"); +} + +public interface ITransient64 +{ + void SayHi(); +} +public class Transient64() : ITransient64 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 64"); +} + +public interface ITransient65 +{ + void SayHi(); +} +public class Transient65() : ITransient65 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 65"); +} + +public interface ITransient66 +{ + void SayHi(); +} +public class Transient66() : ITransient66 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 66"); +} + +public interface ITransient67 +{ + void SayHi(); +} +public class Transient67() : ITransient67 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 67"); +} + +public interface ITransient68 +{ + void SayHi(); +} +public class Transient68() : ITransient68 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 68"); +} + +public interface ITransient69 +{ + void SayHi(); +} +public class Transient69() : ITransient69 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 69"); +} + +public interface ITransient70 +{ + void SayHi(); +} +public class Transient70() : ITransient70 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 70"); +} + +public interface ITransient71 +{ + void SayHi(); +} +public class Transient71() : ITransient71 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 71"); +} + +public interface ITransient72 +{ + void SayHi(); +} +public class Transient72() : ITransient72 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 72"); +} + +public interface ITransient73 +{ + void SayHi(); +} +public class Transient73() : ITransient73 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 73"); +} + +public interface ITransient74 +{ + void SayHi(); +} +public class Transient74() : ITransient74 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 74"); +} + +public interface ITransient75 +{ + void SayHi(); +} +public class Transient75() : ITransient75 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 75"); +} + +public interface ITransient76 +{ + void SayHi(); +} +public class Transient76() : ITransient76 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 76"); +} + +public interface ITransient77 +{ + void SayHi(); +} +public class Transient77() : ITransient77 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 77"); +} + +public interface ITransient78 +{ + void SayHi(); +} +public class Transient78() : ITransient78 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 78"); +} + +public interface ITransient79 +{ + void SayHi(); +} +public class Transient79() : ITransient79 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 79"); +} + +public interface ITransient80 +{ + void SayHi(); +} +public class Transient80() : ITransient80 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 80"); +} + +public interface ITransient81 +{ + void SayHi(); +} +public class Transient81() : ITransient81 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 81"); +} + +public interface ITransient82 +{ + void SayHi(); +} +public class Transient82() : ITransient82 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 82"); +} + +public interface ITransient83 +{ + void SayHi(); +} +public class Transient83() : ITransient83 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 83"); +} + +public interface ITransient84 +{ + void SayHi(); +} +public class Transient84() : ITransient84 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 84"); +} + +public interface ITransient85 +{ + void SayHi(); +} +public class Transient85() : ITransient85 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 85"); +} + +public interface ITransient86 +{ + void SayHi(); +} +public class Transient86() : ITransient86 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 86"); +} + +public interface ITransient87 +{ + void SayHi(); +} +public class Transient87() : ITransient87 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 87"); +} + +public interface ITransient88 +{ + void SayHi(); +} +public class Transient88() : ITransient88 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 88"); +} + +public interface ITransient89 +{ + void SayHi(); +} +public class Transient89() : ITransient89 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 89"); +} + +public interface ITransient90 +{ + void SayHi(); +} +public class Transient90() : ITransient90 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 90"); +} + +public interface ITransient91 +{ + void SayHi(); +} +public class Transient91() : ITransient91 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 91"); +} + +public interface ITransient92 +{ + void SayHi(); +} +public class Transient92() : ITransient92 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 92"); +} + +public interface ITransient93 +{ + void SayHi(); +} +public class Transient93() : ITransient93 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 93"); +} + +public interface ITransient94 +{ + void SayHi(); +} +public class Transient94() : ITransient94 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 94"); +} + +public interface ITransient95 +{ + void SayHi(); +} +public class Transient95() : ITransient95 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 95"); +} + +public interface ITransient96 +{ + void SayHi(); +} +public class Transient96() : ITransient96 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 96"); +} + +public interface ITransient97 +{ + void SayHi(); +} +public class Transient97() : ITransient97 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 97"); +} + +public interface ITransient98 +{ + void SayHi(); +} +public class Transient98() : ITransient98 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 98"); +} + +public interface ITransient99 +{ + void SayHi(); +} +public class Transient99() : ITransient99 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 99"); +} + +public interface ITransient100 +{ + void SayHi(); +} +public class Transient100() : ITransient100 +{ + public void SayHi() => Console.WriteLine("Hello from Transient 100"); +} diff --git a/src/Jab.Performance/Deep/02-Transient/DeepTransientBenchmark.cs b/src/Jab.Performance/Deep/02-Transient/DeepTransientBenchmark.cs new file mode 100644 index 0000000..606d65d --- /dev/null +++ b/src/Jab.Performance/Deep/02-Transient/DeepTransientBenchmark.cs @@ -0,0 +1,259 @@ +namespace Jab.Performance.Deep.Transient; + +using BenchmarkDotNet.Attributes; +using Jab.Performance.Deep.Singleton; +using Microsoft.Extensions.DependencyInjection; +using MEDI = Microsoft.Extensions.DependencyInjection; + +[MemoryDiagnoser] +public class DeepTransientBenchmark +{ + private readonly MEDI.ServiceProvider _provider; + private readonly DeepContainerTransient _container = new(); + + public DeepTransientBenchmark() + { + var serviceCollection = new ServiceCollection(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + + _provider = serviceCollection.BuildServiceProvider(); + } + + [Params(1, 10, 100)] + public int NumbersOfCalls { get; set; } + + [Params(1, 10, 100)] + public int Deep { get; set; } + + [Benchmark(Baseline = true)] + public void Jab() + { + for (var i = 0; i < NumbersOfCalls; i++) + { + if (Deep == 1) + _container.GetService(); + if (Deep == 10) + _container.GetService(); + if (Deep == 100) + _container.GetService(); + } + } + + [Benchmark] + public void MEDI() + { + for (var i = 0; i < NumbersOfCalls; i++) + { + if (Deep == 1) + _provider.GetService(); + if (Deep == 10) + _provider.GetService(); + if (Deep == 100) + _provider.GetService(); + } + } +} + +[ServiceProvider] +[Transient(typeof(ITransient1), typeof(Transient1))] +[Transient(typeof(ITransient2), typeof(Transient2))] +[Transient(typeof(ITransient3), typeof(Transient3))] +[Transient(typeof(ITransient4), typeof(Transient4))] +[Transient(typeof(ITransient5), typeof(Transient5))] +[Transient(typeof(ITransient6), typeof(Transient6))] +[Transient(typeof(ITransient7), typeof(Transient7))] +[Transient(typeof(ITransient8), typeof(Transient8))] +[Transient(typeof(ITransient9), typeof(Transient9))] +[Transient(typeof(ITransient10), typeof(Transient10))] +[Transient(typeof(ITransient11), typeof(Transient11))] +[Transient(typeof(ITransient12), typeof(Transient12))] +[Transient(typeof(ITransient13), typeof(Transient13))] +[Transient(typeof(ITransient14), typeof(Transient14))] +[Transient(typeof(ITransient15), typeof(Transient15))] +[Transient(typeof(ITransient16), typeof(Transient16))] +[Transient(typeof(ITransient17), typeof(Transient17))] +[Transient(typeof(ITransient18), typeof(Transient18))] +[Transient(typeof(ITransient19), typeof(Transient19))] +[Transient(typeof(ITransient20), typeof(Transient20))] +[Transient(typeof(ITransient21), typeof(Transient21))] +[Transient(typeof(ITransient22), typeof(Transient22))] +[Transient(typeof(ITransient23), typeof(Transient23))] +[Transient(typeof(ITransient24), typeof(Transient24))] +[Transient(typeof(ITransient25), typeof(Transient25))] +[Transient(typeof(ITransient26), typeof(Transient26))] +[Transient(typeof(ITransient27), typeof(Transient27))] +[Transient(typeof(ITransient28), typeof(Transient28))] +[Transient(typeof(ITransient29), typeof(Transient29))] +[Transient(typeof(ITransient30), typeof(Transient30))] +[Transient(typeof(ITransient31), typeof(Transient31))] +[Transient(typeof(ITransient32), typeof(Transient32))] +[Transient(typeof(ITransient33), typeof(Transient33))] +[Transient(typeof(ITransient34), typeof(Transient34))] +[Transient(typeof(ITransient35), typeof(Transient35))] +[Transient(typeof(ITransient36), typeof(Transient36))] +[Transient(typeof(ITransient37), typeof(Transient37))] +[Transient(typeof(ITransient38), typeof(Transient38))] +[Transient(typeof(ITransient39), typeof(Transient39))] +[Transient(typeof(ITransient40), typeof(Transient40))] +[Transient(typeof(ITransient41), typeof(Transient41))] +[Transient(typeof(ITransient42), typeof(Transient42))] +[Transient(typeof(ITransient43), typeof(Transient43))] +[Transient(typeof(ITransient44), typeof(Transient44))] +[Transient(typeof(ITransient45), typeof(Transient45))] +[Transient(typeof(ITransient46), typeof(Transient46))] +[Transient(typeof(ITransient47), typeof(Transient47))] +[Transient(typeof(ITransient48), typeof(Transient48))] +[Transient(typeof(ITransient49), typeof(Transient49))] +[Transient(typeof(ITransient50), typeof(Transient50))] +[Transient(typeof(ITransient51), typeof(Transient51))] +[Transient(typeof(ITransient52), typeof(Transient52))] +[Transient(typeof(ITransient53), typeof(Transient53))] +[Transient(typeof(ITransient54), typeof(Transient54))] +[Transient(typeof(ITransient55), typeof(Transient55))] +[Transient(typeof(ITransient56), typeof(Transient56))] +[Transient(typeof(ITransient57), typeof(Transient57))] +[Transient(typeof(ITransient58), typeof(Transient58))] +[Transient(typeof(ITransient59), typeof(Transient59))] +[Transient(typeof(ITransient60), typeof(Transient60))] +[Transient(typeof(ITransient61), typeof(Transient61))] +[Transient(typeof(ITransient62), typeof(Transient62))] +[Transient(typeof(ITransient63), typeof(Transient63))] +[Transient(typeof(ITransient64), typeof(Transient64))] +[Transient(typeof(ITransient65), typeof(Transient65))] +[Transient(typeof(ITransient66), typeof(Transient66))] +[Transient(typeof(ITransient67), typeof(Transient67))] +[Transient(typeof(ITransient68), typeof(Transient68))] +[Transient(typeof(ITransient69), typeof(Transient69))] +[Transient(typeof(ITransient70), typeof(Transient70))] +[Transient(typeof(ITransient71), typeof(Transient71))] +[Transient(typeof(ITransient72), typeof(Transient72))] +[Transient(typeof(ITransient73), typeof(Transient73))] +[Transient(typeof(ITransient74), typeof(Transient74))] +[Transient(typeof(ITransient75), typeof(Transient75))] +[Transient(typeof(ITransient76), typeof(Transient76))] +[Transient(typeof(ITransient77), typeof(Transient77))] +[Transient(typeof(ITransient78), typeof(Transient78))] +[Transient(typeof(ITransient79), typeof(Transient79))] +[Transient(typeof(ITransient80), typeof(Transient80))] +[Transient(typeof(ITransient81), typeof(Transient81))] +[Transient(typeof(ITransient82), typeof(Transient82))] +[Transient(typeof(ITransient83), typeof(Transient83))] +[Transient(typeof(ITransient84), typeof(Transient84))] +[Transient(typeof(ITransient85), typeof(Transient85))] +[Transient(typeof(ITransient86), typeof(Transient86))] +[Transient(typeof(ITransient87), typeof(Transient87))] +[Transient(typeof(ITransient88), typeof(Transient88))] +[Transient(typeof(ITransient89), typeof(Transient89))] +[Transient(typeof(ITransient90), typeof(Transient90))] +[Transient(typeof(ITransient91), typeof(Transient91))] +[Transient(typeof(ITransient92), typeof(Transient92))] +[Transient(typeof(ITransient93), typeof(Transient93))] +[Transient(typeof(ITransient94), typeof(Transient94))] +[Transient(typeof(ITransient95), typeof(Transient95))] +[Transient(typeof(ITransient96), typeof(Transient96))] +[Transient(typeof(ITransient97), typeof(Transient97))] +[Transient(typeof(ITransient98), typeof(Transient98))] +[Transient(typeof(ITransient99), typeof(Transient99))] +[Transient(typeof(ITransient100), typeof(Transient100))] +internal partial class DeepContainerTransient +{ +} \ No newline at end of file diff --git a/src/Jab.Performance/Deep/03-Scoped/Classes.cs b/src/Jab.Performance/Deep/03-Scoped/Classes.cs new file mode 100644 index 0000000..a958a26 --- /dev/null +++ b/src/Jab.Performance/Deep/03-Scoped/Classes.cs @@ -0,0 +1,902 @@ +namespace Jab.Performance.Deep.Scoped; + +public interface IScoped1 +{ + void SayHi(); +} +public class Scoped1() : IScoped1 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 1"); +} + +public interface IScoped2 +{ + void SayHi(); +} +public class Scoped2() : IScoped2 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 2"); +} + +public interface IScoped3 +{ + void SayHi(); +} +public class Scoped3() : IScoped3 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 3"); +} + +public interface IScoped4 +{ + void SayHi(); +} +public class Scoped4() : IScoped4 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 4"); +} + +public interface IScoped5 +{ + void SayHi(); +} +public class Scoped5() : IScoped5 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 5"); +} + +public interface IScoped6 +{ + void SayHi(); +} +public class Scoped6() : IScoped6 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 6"); +} + +public interface IScoped7 +{ + void SayHi(); +} +public class Scoped7() : IScoped7 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 7"); +} + +public interface IScoped8 +{ + void SayHi(); +} +public class Scoped8() : IScoped8 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 8"); +} + +public interface IScoped9 +{ + void SayHi(); +} +public class Scoped9() : IScoped9 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 9"); +} + +public interface IScoped10 +{ + void SayHi(); +} +public class Scoped10() : IScoped10 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 10"); +} + +public interface IScoped11 +{ + void SayHi(); +} +public class Scoped11() : IScoped11 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 11"); +} + +public interface IScoped12 +{ + void SayHi(); +} +public class Scoped12() : IScoped12 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 12"); +} + +public interface IScoped13 +{ + void SayHi(); +} +public class Scoped13() : IScoped13 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 13"); +} + +public interface IScoped14 +{ + void SayHi(); +} +public class Scoped14() : IScoped14 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 14"); +} + +public interface IScoped15 +{ + void SayHi(); +} +public class Scoped15() : IScoped15 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 15"); +} + +public interface IScoped16 +{ + void SayHi(); +} +public class Scoped16() : IScoped16 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 16"); +} + +public interface IScoped17 +{ + void SayHi(); +} +public class Scoped17() : IScoped17 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 17"); +} + +public interface IScoped18 +{ + void SayHi(); +} +public class Scoped18() : IScoped18 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 18"); +} + +public interface IScoped19 +{ + void SayHi(); +} +public class Scoped19() : IScoped19 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 19"); +} + +public interface IScoped20 +{ + void SayHi(); +} +public class Scoped20() : IScoped20 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 20"); +} + +public interface IScoped21 +{ + void SayHi(); +} +public class Scoped21() : IScoped21 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 21"); +} + +public interface IScoped22 +{ + void SayHi(); +} +public class Scoped22() : IScoped22 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 22"); +} + +public interface IScoped23 +{ + void SayHi(); +} +public class Scoped23() : IScoped23 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 23"); +} + +public interface IScoped24 +{ + void SayHi(); +} +public class Scoped24() : IScoped24 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 24"); +} + +public interface IScoped25 +{ + void SayHi(); +} +public class Scoped25() : IScoped25 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 25"); +} + +public interface IScoped26 +{ + void SayHi(); +} +public class Scoped26() : IScoped26 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 26"); +} + +public interface IScoped27 +{ + void SayHi(); +} +public class Scoped27() : IScoped27 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 27"); +} + +public interface IScoped28 +{ + void SayHi(); +} +public class Scoped28() : IScoped28 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 28"); +} + +public interface IScoped29 +{ + void SayHi(); +} +public class Scoped29() : IScoped29 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 29"); +} + +public interface IScoped30 +{ + void SayHi(); +} +public class Scoped30() : IScoped30 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 30"); +} + +public interface IScoped31 +{ + void SayHi(); +} +public class Scoped31() : IScoped31 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 31"); +} + +public interface IScoped32 +{ + void SayHi(); +} +public class Scoped32() : IScoped32 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 32"); +} + +public interface IScoped33 +{ + void SayHi(); +} +public class Scoped33() : IScoped33 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 33"); +} + +public interface IScoped34 +{ + void SayHi(); +} +public class Scoped34() : IScoped34 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 34"); +} + +public interface IScoped35 +{ + void SayHi(); +} +public class Scoped35() : IScoped35 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 35"); +} + +public interface IScoped36 +{ + void SayHi(); +} +public class Scoped36() : IScoped36 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 36"); +} + +public interface IScoped37 +{ + void SayHi(); +} +public class Scoped37() : IScoped37 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 37"); +} + +public interface IScoped38 +{ + void SayHi(); +} +public class Scoped38() : IScoped38 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 38"); +} + +public interface IScoped39 +{ + void SayHi(); +} +public class Scoped39() : IScoped39 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 39"); +} + +public interface IScoped40 +{ + void SayHi(); +} +public class Scoped40() : IScoped40 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 40"); +} + +public interface IScoped41 +{ + void SayHi(); +} +public class Scoped41() : IScoped41 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 41"); +} + +public interface IScoped42 +{ + void SayHi(); +} +public class Scoped42() : IScoped42 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 42"); +} + +public interface IScoped43 +{ + void SayHi(); +} +public class Scoped43() : IScoped43 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 43"); +} + +public interface IScoped44 +{ + void SayHi(); +} +public class Scoped44() : IScoped44 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 44"); +} + +public interface IScoped45 +{ + void SayHi(); +} +public class Scoped45() : IScoped45 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 45"); +} + +public interface IScoped46 +{ + void SayHi(); +} +public class Scoped46() : IScoped46 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 46"); +} + +public interface IScoped47 +{ + void SayHi(); +} +public class Scoped47() : IScoped47 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 47"); +} + +public interface IScoped48 +{ + void SayHi(); +} +public class Scoped48() : IScoped48 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 48"); +} + +public interface IScoped49 +{ + void SayHi(); +} +public class Scoped49() : IScoped49 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 49"); +} + +public interface IScoped50 +{ + void SayHi(); +} +public class Scoped50() : IScoped50 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 50"); +} + +public interface IScoped51 +{ + void SayHi(); +} +public class Scoped51() : IScoped51 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 51"); +} + +public interface IScoped52 +{ + void SayHi(); +} +public class Scoped52() : IScoped52 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 52"); +} + +public interface IScoped53 +{ + void SayHi(); +} +public class Scoped53() : IScoped53 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 53"); +} + +public interface IScoped54 +{ + void SayHi(); +} +public class Scoped54() : IScoped54 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 54"); +} + +public interface IScoped55 +{ + void SayHi(); +} +public class Scoped55() : IScoped55 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 55"); +} + +public interface IScoped56 +{ + void SayHi(); +} +public class Scoped56() : IScoped56 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 56"); +} + +public interface IScoped57 +{ + void SayHi(); +} +public class Scoped57() : IScoped57 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 57"); +} + +public interface IScoped58 +{ + void SayHi(); +} +public class Scoped58() : IScoped58 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 58"); +} + +public interface IScoped59 +{ + void SayHi(); +} +public class Scoped59() : IScoped59 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 59"); +} + +public interface IScoped60 +{ + void SayHi(); +} +public class Scoped60() : IScoped60 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 60"); +} + +public interface IScoped61 +{ + void SayHi(); +} +public class Scoped61() : IScoped61 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 61"); +} + +public interface IScoped62 +{ + void SayHi(); +} +public class Scoped62() : IScoped62 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 62"); +} + +public interface IScoped63 +{ + void SayHi(); +} +public class Scoped63() : IScoped63 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 63"); +} + +public interface IScoped64 +{ + void SayHi(); +} +public class Scoped64() : IScoped64 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 64"); +} + +public interface IScoped65 +{ + void SayHi(); +} +public class Scoped65() : IScoped65 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 65"); +} + +public interface IScoped66 +{ + void SayHi(); +} +public class Scoped66() : IScoped66 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 66"); +} + +public interface IScoped67 +{ + void SayHi(); +} +public class Scoped67() : IScoped67 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 67"); +} + +public interface IScoped68 +{ + void SayHi(); +} +public class Scoped68() : IScoped68 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 68"); +} + +public interface IScoped69 +{ + void SayHi(); +} +public class Scoped69() : IScoped69 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 69"); +} + +public interface IScoped70 +{ + void SayHi(); +} +public class Scoped70() : IScoped70 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 70"); +} + +public interface IScoped71 +{ + void SayHi(); +} +public class Scoped71() : IScoped71 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 71"); +} + +public interface IScoped72 +{ + void SayHi(); +} +public class Scoped72() : IScoped72 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 72"); +} + +public interface IScoped73 +{ + void SayHi(); +} +public class Scoped73() : IScoped73 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 73"); +} + +public interface IScoped74 +{ + void SayHi(); +} +public class Scoped74() : IScoped74 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 74"); +} + +public interface IScoped75 +{ + void SayHi(); +} +public class Scoped75() : IScoped75 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 75"); +} + +public interface IScoped76 +{ + void SayHi(); +} +public class Scoped76() : IScoped76 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 76"); +} + +public interface IScoped77 +{ + void SayHi(); +} +public class Scoped77() : IScoped77 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 77"); +} + +public interface IScoped78 +{ + void SayHi(); +} +public class Scoped78() : IScoped78 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 78"); +} + +public interface IScoped79 +{ + void SayHi(); +} +public class Scoped79() : IScoped79 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 79"); +} + +public interface IScoped80 +{ + void SayHi(); +} +public class Scoped80() : IScoped80 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 80"); +} + +public interface IScoped81 +{ + void SayHi(); +} +public class Scoped81() : IScoped81 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 81"); +} + +public interface IScoped82 +{ + void SayHi(); +} +public class Scoped82() : IScoped82 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 82"); +} + +public interface IScoped83 +{ + void SayHi(); +} +public class Scoped83() : IScoped83 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 83"); +} + +public interface IScoped84 +{ + void SayHi(); +} +public class Scoped84() : IScoped84 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 84"); +} + +public interface IScoped85 +{ + void SayHi(); +} +public class Scoped85() : IScoped85 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 85"); +} + +public interface IScoped86 +{ + void SayHi(); +} +public class Scoped86() : IScoped86 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 86"); +} + +public interface IScoped87 +{ + void SayHi(); +} +public class Scoped87() : IScoped87 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 87"); +} + +public interface IScoped88 +{ + void SayHi(); +} +public class Scoped88() : IScoped88 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 88"); +} + +public interface IScoped89 +{ + void SayHi(); +} +public class Scoped89() : IScoped89 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 89"); +} + +public interface IScoped90 +{ + void SayHi(); +} +public class Scoped90() : IScoped90 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 90"); +} + +public interface IScoped91 +{ + void SayHi(); +} +public class Scoped91() : IScoped91 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 91"); +} + +public interface IScoped92 +{ + void SayHi(); +} +public class Scoped92() : IScoped92 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 92"); +} + +public interface IScoped93 +{ + void SayHi(); +} +public class Scoped93() : IScoped93 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 93"); +} + +public interface IScoped94 +{ + void SayHi(); +} +public class Scoped94() : IScoped94 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 94"); +} + +public interface IScoped95 +{ + void SayHi(); +} +public class Scoped95() : IScoped95 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 95"); +} + +public interface IScoped96 +{ + void SayHi(); +} +public class Scoped96() : IScoped96 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 96"); +} + +public interface IScoped97 +{ + void SayHi(); +} +public class Scoped97() : IScoped97 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 97"); +} + +public interface IScoped98 +{ + void SayHi(); +} +public class Scoped98() : IScoped98 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 98"); +} + +public interface IScoped99 +{ + void SayHi(); +} +public class Scoped99() : IScoped99 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 99"); +} + +public interface IScoped100 +{ + void SayHi(); +} +public class Scoped100() : IScoped100 +{ + public void SayHi() => Console.WriteLine("Hello from Scoped 100"); +} + diff --git a/src/Jab.Performance/Deep/03-Scoped/DeepScopedBenchmark.cs b/src/Jab.Performance/Deep/03-Scoped/DeepScopedBenchmark.cs new file mode 100644 index 0000000..0a7e958 --- /dev/null +++ b/src/Jab.Performance/Deep/03-Scoped/DeepScopedBenchmark.cs @@ -0,0 +1,263 @@ +namespace Jab.Performance.Deep.Scoped; + +using BenchmarkDotNet.Attributes; +using Jab.Performance.Deep.Transient; +using Microsoft.Extensions.DependencyInjection; +using MEDI = Microsoft.Extensions.DependencyInjection; + +[MemoryDiagnoser] +public class DeepScopedBenchmark +{ + private readonly MEDI.ServiceProvider _provider; + private readonly DeepContainerScoped _container = new(); + + public DeepScopedBenchmark() + { + var serviceCollection = new ServiceCollection(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + + _provider = serviceCollection.BuildServiceProvider(); + } + + [Params(1, 10, 100)] + public int NumbersOfCalls { get; set; } + + [Params(1, 10, 100)] + public int Deep { get; set; } + + [Benchmark(Baseline = true)] + public void Jab() + { + for (var i = 0; i < NumbersOfCalls; i++) + { + using var scope = _container.CreateScope(); + + if (Deep == 1) + scope.GetService(); + if (Deep == 10) + scope.GetService(); + if (Deep == 100) + scope.GetService(); + } + } + + [Benchmark] + public void MEDI() + { + for (var i = 0; i < NumbersOfCalls; i++) + { + using var scope = _provider.CreateScope(); + + if (Deep == 1) + scope.ServiceProvider.GetService(); + if (Deep == 10) + scope.ServiceProvider.GetService(); + if (Deep == 100) + scope.ServiceProvider.GetService(); + } + } +} + +[ServiceProvider] +[Scoped(typeof(IScoped1), typeof(Scoped1))] +[Scoped(typeof(IScoped2), typeof(Scoped2))] +[Scoped(typeof(IScoped3), typeof(Scoped3))] +[Scoped(typeof(IScoped4), typeof(Scoped4))] +[Scoped(typeof(IScoped5), typeof(Scoped5))] +[Scoped(typeof(IScoped6), typeof(Scoped6))] +[Scoped(typeof(IScoped7), typeof(Scoped7))] +[Scoped(typeof(IScoped8), typeof(Scoped8))] +[Scoped(typeof(IScoped9), typeof(Scoped9))] +[Scoped(typeof(IScoped10), typeof(Scoped10))] +[Scoped(typeof(IScoped11), typeof(Scoped11))] +[Scoped(typeof(IScoped12), typeof(Scoped12))] +[Scoped(typeof(IScoped13), typeof(Scoped13))] +[Scoped(typeof(IScoped14), typeof(Scoped14))] +[Scoped(typeof(IScoped15), typeof(Scoped15))] +[Scoped(typeof(IScoped16), typeof(Scoped16))] +[Scoped(typeof(IScoped17), typeof(Scoped17))] +[Scoped(typeof(IScoped18), typeof(Scoped18))] +[Scoped(typeof(IScoped19), typeof(Scoped19))] +[Scoped(typeof(IScoped20), typeof(Scoped20))] +[Scoped(typeof(IScoped21), typeof(Scoped21))] +[Scoped(typeof(IScoped22), typeof(Scoped22))] +[Scoped(typeof(IScoped23), typeof(Scoped23))] +[Scoped(typeof(IScoped24), typeof(Scoped24))] +[Scoped(typeof(IScoped25), typeof(Scoped25))] +[Scoped(typeof(IScoped26), typeof(Scoped26))] +[Scoped(typeof(IScoped27), typeof(Scoped27))] +[Scoped(typeof(IScoped28), typeof(Scoped28))] +[Scoped(typeof(IScoped29), typeof(Scoped29))] +[Scoped(typeof(IScoped30), typeof(Scoped30))] +[Scoped(typeof(IScoped31), typeof(Scoped31))] +[Scoped(typeof(IScoped32), typeof(Scoped32))] +[Scoped(typeof(IScoped33), typeof(Scoped33))] +[Scoped(typeof(IScoped34), typeof(Scoped34))] +[Scoped(typeof(IScoped35), typeof(Scoped35))] +[Scoped(typeof(IScoped36), typeof(Scoped36))] +[Scoped(typeof(IScoped37), typeof(Scoped37))] +[Scoped(typeof(IScoped38), typeof(Scoped38))] +[Scoped(typeof(IScoped39), typeof(Scoped39))] +[Scoped(typeof(IScoped40), typeof(Scoped40))] +[Scoped(typeof(IScoped41), typeof(Scoped41))] +[Scoped(typeof(IScoped42), typeof(Scoped42))] +[Scoped(typeof(IScoped43), typeof(Scoped43))] +[Scoped(typeof(IScoped44), typeof(Scoped44))] +[Scoped(typeof(IScoped45), typeof(Scoped45))] +[Scoped(typeof(IScoped46), typeof(Scoped46))] +[Scoped(typeof(IScoped47), typeof(Scoped47))] +[Scoped(typeof(IScoped48), typeof(Scoped48))] +[Scoped(typeof(IScoped49), typeof(Scoped49))] +[Scoped(typeof(IScoped50), typeof(Scoped50))] +[Scoped(typeof(IScoped51), typeof(Scoped51))] +[Scoped(typeof(IScoped52), typeof(Scoped52))] +[Scoped(typeof(IScoped53), typeof(Scoped53))] +[Scoped(typeof(IScoped54), typeof(Scoped54))] +[Scoped(typeof(IScoped55), typeof(Scoped55))] +[Scoped(typeof(IScoped56), typeof(Scoped56))] +[Scoped(typeof(IScoped57), typeof(Scoped57))] +[Scoped(typeof(IScoped58), typeof(Scoped58))] +[Scoped(typeof(IScoped59), typeof(Scoped59))] +[Scoped(typeof(IScoped60), typeof(Scoped60))] +[Scoped(typeof(IScoped61), typeof(Scoped61))] +[Scoped(typeof(IScoped62), typeof(Scoped62))] +[Scoped(typeof(IScoped63), typeof(Scoped63))] +[Scoped(typeof(IScoped64), typeof(Scoped64))] +[Scoped(typeof(IScoped65), typeof(Scoped65))] +[Scoped(typeof(IScoped66), typeof(Scoped66))] +[Scoped(typeof(IScoped67), typeof(Scoped67))] +[Scoped(typeof(IScoped68), typeof(Scoped68))] +[Scoped(typeof(IScoped69), typeof(Scoped69))] +[Scoped(typeof(IScoped70), typeof(Scoped70))] +[Scoped(typeof(IScoped71), typeof(Scoped71))] +[Scoped(typeof(IScoped72), typeof(Scoped72))] +[Scoped(typeof(IScoped73), typeof(Scoped73))] +[Scoped(typeof(IScoped74), typeof(Scoped74))] +[Scoped(typeof(IScoped75), typeof(Scoped75))] +[Scoped(typeof(IScoped76), typeof(Scoped76))] +[Scoped(typeof(IScoped77), typeof(Scoped77))] +[Scoped(typeof(IScoped78), typeof(Scoped78))] +[Scoped(typeof(IScoped79), typeof(Scoped79))] +[Scoped(typeof(IScoped80), typeof(Scoped80))] +[Scoped(typeof(IScoped81), typeof(Scoped81))] +[Scoped(typeof(IScoped82), typeof(Scoped82))] +[Scoped(typeof(IScoped83), typeof(Scoped83))] +[Scoped(typeof(IScoped84), typeof(Scoped84))] +[Scoped(typeof(IScoped85), typeof(Scoped85))] +[Scoped(typeof(IScoped86), typeof(Scoped86))] +[Scoped(typeof(IScoped87), typeof(Scoped87))] +[Scoped(typeof(IScoped88), typeof(Scoped88))] +[Scoped(typeof(IScoped89), typeof(Scoped89))] +[Scoped(typeof(IScoped90), typeof(Scoped90))] +[Scoped(typeof(IScoped91), typeof(Scoped91))] +[Scoped(typeof(IScoped92), typeof(Scoped92))] +[Scoped(typeof(IScoped93), typeof(Scoped93))] +[Scoped(typeof(IScoped94), typeof(Scoped94))] +[Scoped(typeof(IScoped95), typeof(Scoped95))] +[Scoped(typeof(IScoped96), typeof(Scoped96))] +[Scoped(typeof(IScoped97), typeof(Scoped97))] +[Scoped(typeof(IScoped98), typeof(Scoped98))] +[Scoped(typeof(IScoped99), typeof(Scoped99))] +[Scoped(typeof(IScoped100), typeof(Scoped100))] +internal partial class DeepContainerScoped +{ +} \ No newline at end of file diff --git a/src/Jab.Performance/Deep/04-Mixed/Classes.cs b/src/Jab.Performance/Deep/04-Mixed/Classes.cs new file mode 100644 index 0000000..929fb39 --- /dev/null +++ b/src/Jab.Performance/Deep/04-Mixed/Classes.cs @@ -0,0 +1,1505 @@ +namespace Jab.Performance.Deep.Mixed; + +using Jab.Performance.Deep.Singleton; +using Jab.Performance.Deep.Transient; + +public interface IMix1 +{ + void SayHi(); +} + +public class Mix1(ISingleton1 singleton1, ITransient1 transient1) : IMix1 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 1"); + singleton1.SayHi(); + transient1.SayHi(); + } +} + +public interface IMix2 +{ + void SayHi(); +} + +public class Mix2(ISingleton2 singleton2, ITransient2 transient2) : IMix2 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 2"); + singleton2.SayHi(); + transient2.SayHi(); + } +} + +public interface IMix3 +{ + void SayHi(); +} + +public class Mix3(ISingleton3 singleton3, ITransient3 transient3) : IMix3 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 3"); + singleton3.SayHi(); + transient3.SayHi(); + } +} + +public interface IMix4 +{ + void SayHi(); +} + +public class Mix4(ISingleton4 singleton4, ITransient4 transient4) : IMix4 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 4"); + singleton4.SayHi(); + transient4.SayHi(); + } +} + +public interface IMix5 +{ + void SayHi(); +} + +public class Mix5(ISingleton5 singleton5, ITransient5 transient5) : IMix5 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 5"); + singleton5.SayHi(); + transient5.SayHi(); + } +} + +public interface IMix6 +{ + void SayHi(); +} + +public class Mix6(ISingleton6 singleton6, ITransient6 transient6) : IMix6 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 6"); + singleton6.SayHi(); + transient6.SayHi(); + } +} + +public interface IMix7 +{ + void SayHi(); +} + +public class Mix7(ISingleton7 singleton7, ITransient7 transient7) : IMix7 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 7"); + singleton7.SayHi(); + transient7.SayHi(); + } +} + +public interface IMix8 +{ + void SayHi(); +} + +public class Mix8(ISingleton8 singleton8, ITransient8 transient8) : IMix8 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 8"); + singleton8.SayHi(); + transient8.SayHi(); + } +} + +public interface IMix9 +{ + void SayHi(); +} + +public class Mix9(ISingleton9 singleton9, ITransient9 transient9) : IMix9 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 9"); + singleton9.SayHi(); + transient9.SayHi(); + } +} + +public interface IMix10 +{ + void SayHi(); +} + +public class Mix10(ISingleton10 singleton10, ITransient10 transient10) : IMix10 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 10"); + singleton10.SayHi(); + transient10.SayHi(); + } +} + +public interface IMix11 +{ + void SayHi(); +} + +public class Mix11(ISingleton11 singleton11, ITransient11 transient11) : IMix11 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 11"); + singleton11.SayHi(); + transient11.SayHi(); + } +} + +public interface IMix12 +{ + void SayHi(); +} + +public class Mix12(ISingleton12 singleton12, ITransient12 transient12) : IMix12 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 12"); + singleton12.SayHi(); + transient12.SayHi(); + } +} + +public interface IMix13 +{ + void SayHi(); +} + +public class Mix13(ISingleton13 singleton13, ITransient13 transient13) : IMix13 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 13"); + singleton13.SayHi(); + transient13.SayHi(); + } +} + +public interface IMix14 +{ + void SayHi(); +} + +public class Mix14(ISingleton14 singleton14, ITransient14 transient14) : IMix14 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 14"); + singleton14.SayHi(); + transient14.SayHi(); + } +} + +public interface IMix15 +{ + void SayHi(); +} + +public class Mix15(ISingleton15 singleton15, ITransient15 transient15) : IMix15 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 15"); + singleton15.SayHi(); + transient15.SayHi(); + } +} + +public interface IMix16 +{ + void SayHi(); +} + +public class Mix16(ISingleton16 singleton16, ITransient16 transient16) : IMix16 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 16"); + singleton16.SayHi(); + transient16.SayHi(); + } +} + +public interface IMix17 +{ + void SayHi(); +} + +public class Mix17(ISingleton17 singleton17, ITransient17 transient17) : IMix17 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 17"); + singleton17.SayHi(); + transient17.SayHi(); + } +} + +public interface IMix18 +{ + void SayHi(); +} + +public class Mix18(ISingleton18 singleton18, ITransient18 transient18) : IMix18 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 18"); + singleton18.SayHi(); + transient18.SayHi(); + } +} + +public interface IMix19 +{ + void SayHi(); +} + +public class Mix19(ISingleton19 singleton19, ITransient19 transient19) : IMix19 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 19"); + singleton19.SayHi(); + transient19.SayHi(); + } +} + +public interface IMix20 +{ + void SayHi(); +} + +public class Mix20(ISingleton20 singleton20, ITransient20 transient20) : IMix20 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 20"); + singleton20.SayHi(); + transient20.SayHi(); + } +} + +public interface IMix21 +{ + void SayHi(); +} + +public class Mix21(ISingleton21 singleton21, ITransient21 transient21) : IMix21 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 21"); + singleton21.SayHi(); + transient21.SayHi(); + } +} + +public interface IMix22 +{ + void SayHi(); +} + +public class Mix22(ISingleton22 singleton22, ITransient22 transient22) : IMix22 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 22"); + singleton22.SayHi(); + transient22.SayHi(); + } +} + +public interface IMix23 +{ + void SayHi(); +} + +public class Mix23(ISingleton23 singleton23, ITransient23 transient23) : IMix23 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 23"); + singleton23.SayHi(); + transient23.SayHi(); + } +} + +public interface IMix24 +{ + void SayHi(); +} + +public class Mix24(ISingleton24 singleton24, ITransient24 transient24) : IMix24 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 24"); + singleton24.SayHi(); + transient24.SayHi(); + } +} + +public interface IMix25 +{ + void SayHi(); +} + +public class Mix25(ISingleton25 singleton25, ITransient25 transient25) : IMix25 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 25"); + singleton25.SayHi(); + transient25.SayHi(); + } +} + +public interface IMix26 +{ + void SayHi(); +} + +public class Mix26(ISingleton26 singleton26, ITransient26 transient26) : IMix26 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 26"); + singleton26.SayHi(); + transient26.SayHi(); + } +} + +public interface IMix27 +{ + void SayHi(); +} + +public class Mix27(ISingleton27 singleton27, ITransient27 transient27) : IMix27 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 27"); + singleton27.SayHi(); + transient27.SayHi(); + } +} + +public interface IMix28 +{ + void SayHi(); +} + +public class Mix28(ISingleton28 singleton28, ITransient28 transient28) : IMix28 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 28"); + singleton28.SayHi(); + transient28.SayHi(); + } +} + +public interface IMix29 +{ + void SayHi(); +} + +public class Mix29(ISingleton29 singleton29, ITransient29 transient29) : IMix29 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 29"); + singleton29.SayHi(); + transient29.SayHi(); + } +} + +public interface IMix30 +{ + void SayHi(); +} + +public class Mix30(ISingleton30 singleton30, ITransient30 transient30) : IMix30 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 30"); + singleton30.SayHi(); + transient30.SayHi(); + } +} + +public interface IMix31 +{ + void SayHi(); +} + +public class Mix31(ISingleton31 singleton31, ITransient31 transient31) : IMix31 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 31"); + singleton31.SayHi(); + transient31.SayHi(); + } +} + +public interface IMix32 +{ + void SayHi(); +} + +public class Mix32(ISingleton32 singleton32, ITransient32 transient32) : IMix32 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 32"); + singleton32.SayHi(); + transient32.SayHi(); + } +} + +public interface IMix33 +{ + void SayHi(); +} + +public class Mix33(ISingleton33 singleton33, ITransient33 transient33) : IMix33 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 33"); + singleton33.SayHi(); + transient33.SayHi(); + } +} + +public interface IMix34 +{ + void SayHi(); +} + +public class Mix34(ISingleton34 singleton34, ITransient34 transient34) : IMix34 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 34"); + singleton34.SayHi(); + transient34.SayHi(); + } +} + +public interface IMix35 +{ + void SayHi(); +} + +public class Mix35(ISingleton35 singleton35, ITransient35 transient35) : IMix35 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 35"); + singleton35.SayHi(); + transient35.SayHi(); + } +} + +public interface IMix36 +{ + void SayHi(); +} + +public class Mix36(ISingleton36 singleton36, ITransient36 transient36) : IMix36 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 36"); + singleton36.SayHi(); + transient36.SayHi(); + } +} + +public interface IMix37 +{ + void SayHi(); +} + +public class Mix37(ISingleton37 singleton37, ITransient37 transient37) : IMix37 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 37"); + singleton37.SayHi(); + transient37.SayHi(); + } +} + +public interface IMix38 +{ + void SayHi(); +} + +public class Mix38(ISingleton38 singleton38, ITransient38 transient38) : IMix38 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 38"); + singleton38.SayHi(); + transient38.SayHi(); + } +} + +public interface IMix39 +{ + void SayHi(); +} + +public class Mix39(ISingleton39 singleton39, ITransient39 transient39) : IMix39 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 39"); + singleton39.SayHi(); + transient39.SayHi(); + } +} + +public interface IMix40 +{ + void SayHi(); +} + +public class Mix40(ISingleton40 singleton40, ITransient40 transient40) : IMix40 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 40"); + singleton40.SayHi(); + transient40.SayHi(); + } +} + +public interface IMix41 +{ + void SayHi(); +} + +public class Mix41(ISingleton41 singleton41, ITransient41 transient41) : IMix41 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 41"); + singleton41.SayHi(); + transient41.SayHi(); + } +} + +public interface IMix42 +{ + void SayHi(); +} + +public class Mix42(ISingleton42 singleton42, ITransient42 transient42) : IMix42 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 42"); + singleton42.SayHi(); + transient42.SayHi(); + } +} + +public interface IMix43 +{ + void SayHi(); +} + +public class Mix43(ISingleton43 singleton43, ITransient43 transient43) : IMix43 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 43"); + singleton43.SayHi(); + transient43.SayHi(); + } +} + +public interface IMix44 +{ + void SayHi(); +} + +public class Mix44(ISingleton44 singleton44, ITransient44 transient44) : IMix44 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 44"); + singleton44.SayHi(); + transient44.SayHi(); + } +} + +public interface IMix45 +{ + void SayHi(); +} + +public class Mix45(ISingleton45 singleton45, ITransient45 transient45) : IMix45 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 45"); + singleton45.SayHi(); + transient45.SayHi(); + } +} + +public interface IMix46 +{ + void SayHi(); +} + +public class Mix46(ISingleton46 singleton46, ITransient46 transient46) : IMix46 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 46"); + singleton46.SayHi(); + transient46.SayHi(); + } +} + +public interface IMix47 +{ + void SayHi(); +} + +public class Mix47(ISingleton47 singleton47, ITransient47 transient47) : IMix47 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 47"); + singleton47.SayHi(); + transient47.SayHi(); + } +} + +public interface IMix48 +{ + void SayHi(); +} + +public class Mix48(ISingleton48 singleton48, ITransient48 transient48) : IMix48 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 48"); + singleton48.SayHi(); + transient48.SayHi(); + } +} + +public interface IMix49 +{ + void SayHi(); +} + +public class Mix49(ISingleton49 singleton49, ITransient49 transient49) : IMix49 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 49"); + singleton49.SayHi(); + transient49.SayHi(); + } +} + +public interface IMix50 +{ + void SayHi(); +} + +public class Mix50(ISingleton50 singleton50, ITransient50 transient50) : IMix50 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 50"); + singleton50.SayHi(); + transient50.SayHi(); + } +} + +public interface IMix51 +{ + void SayHi(); +} + +public class Mix51(ISingleton51 singleton51, ITransient51 transient51) : IMix51 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 51"); + singleton51.SayHi(); + transient51.SayHi(); + } +} + +public interface IMix52 +{ + void SayHi(); +} + +public class Mix52(ISingleton52 singleton52, ITransient52 transient52) : IMix52 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 52"); + singleton52.SayHi(); + transient52.SayHi(); + } +} + +public interface IMix53 +{ + void SayHi(); +} + +public class Mix53(ISingleton53 singleton53, ITransient53 transient53) : IMix53 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 53"); + singleton53.SayHi(); + transient53.SayHi(); + } +} + +public interface IMix54 +{ + void SayHi(); +} + +public class Mix54(ISingleton54 singleton54, ITransient54 transient54) : IMix54 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 54"); + singleton54.SayHi(); + transient54.SayHi(); + } +} + +public interface IMix55 +{ + void SayHi(); +} + +public class Mix55(ISingleton55 singleton55, ITransient55 transient55) : IMix55 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 55"); + singleton55.SayHi(); + transient55.SayHi(); + } +} + +public interface IMix56 +{ + void SayHi(); +} + +public class Mix56(ISingleton56 singleton56, ITransient56 transient56) : IMix56 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 56"); + singleton56.SayHi(); + transient56.SayHi(); + } +} + +public interface IMix57 +{ + void SayHi(); +} + +public class Mix57(ISingleton57 singleton57, ITransient57 transient57) : IMix57 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 57"); + singleton57.SayHi(); + transient57.SayHi(); + } +} + +public interface IMix58 +{ + void SayHi(); +} + +public class Mix58(ISingleton58 singleton58, ITransient58 transient58) : IMix58 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 58"); + singleton58.SayHi(); + transient58.SayHi(); + } +} + +public interface IMix59 +{ + void SayHi(); +} + +public class Mix59(ISingleton59 singleton59, ITransient59 transient59) : IMix59 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 59"); + singleton59.SayHi(); + transient59.SayHi(); + } +} + +public interface IMix60 +{ + void SayHi(); +} + +public class Mix60(ISingleton60 singleton60, ITransient60 transient60) : IMix60 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 60"); + singleton60.SayHi(); + transient60.SayHi(); + } +} + +public interface IMix61 +{ + void SayHi(); +} + +public class Mix61(ISingleton61 singleton61, ITransient61 transient61) : IMix61 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 61"); + singleton61.SayHi(); + transient61.SayHi(); + } +} + +public interface IMix62 +{ + void SayHi(); +} + +public class Mix62(ISingleton62 singleton62, ITransient62 transient62) : IMix62 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 62"); + singleton62.SayHi(); + transient62.SayHi(); + } +} + +public interface IMix63 +{ + void SayHi(); +} + +public class Mix63(ISingleton63 singleton63, ITransient63 transient63) : IMix63 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 63"); + singleton63.SayHi(); + transient63.SayHi(); + } +} + +public interface IMix64 +{ + void SayHi(); +} + +public class Mix64(ISingleton64 singleton64, ITransient64 transient64) : IMix64 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 64"); + singleton64.SayHi(); + transient64.SayHi(); + } +} + +public interface IMix65 +{ + void SayHi(); +} + +public class Mix65(ISingleton65 singleton65, ITransient65 transient65) : IMix65 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 65"); + singleton65.SayHi(); + transient65.SayHi(); + } +} + +public interface IMix66 +{ + void SayHi(); +} + +public class Mix66(ISingleton66 singleton66, ITransient66 transient66) : IMix66 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 66"); + singleton66.SayHi(); + transient66.SayHi(); + } +} + +public interface IMix67 +{ + void SayHi(); +} + +public class Mix67(ISingleton67 singleton67, ITransient67 transient67) : IMix67 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 67"); + singleton67.SayHi(); + transient67.SayHi(); + } +} + +public interface IMix68 +{ + void SayHi(); +} + +public class Mix68(ISingleton68 singleton68, ITransient68 transient68) : IMix68 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 68"); + singleton68.SayHi(); + transient68.SayHi(); + } +} + +public interface IMix69 +{ + void SayHi(); +} + +public class Mix69(ISingleton69 singleton69, ITransient69 transient69) : IMix69 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 69"); + singleton69.SayHi(); + transient69.SayHi(); + } +} + +public interface IMix70 +{ + void SayHi(); +} + +public class Mix70(ISingleton70 singleton70, ITransient70 transient70) : IMix70 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 70"); + singleton70.SayHi(); + transient70.SayHi(); + } +} + +public interface IMix71 +{ + void SayHi(); +} + +public class Mix71(ISingleton71 singleton71, ITransient71 transient71) : IMix71 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 71"); + singleton71.SayHi(); + transient71.SayHi(); + } +} + +public interface IMix72 +{ + void SayHi(); +} + +public class Mix72(ISingleton72 singleton72, ITransient72 transient72) : IMix72 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 72"); + singleton72.SayHi(); + transient72.SayHi(); + } +} + +public interface IMix73 +{ + void SayHi(); +} + +public class Mix73(ISingleton73 singleton73, ITransient73 transient73) : IMix73 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 73"); + singleton73.SayHi(); + transient73.SayHi(); + } +} + +public interface IMix74 +{ + void SayHi(); +} + +public class Mix74(ISingleton74 singleton74, ITransient74 transient74) : IMix74 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 74"); + singleton74.SayHi(); + transient74.SayHi(); + } +} + +public interface IMix75 +{ + void SayHi(); +} + +public class Mix75(ISingleton75 singleton75, ITransient75 transient75) : IMix75 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 75"); + singleton75.SayHi(); + transient75.SayHi(); + } +} + +public interface IMix76 +{ + void SayHi(); +} + +public class Mix76(ISingleton76 singleton76, ITransient76 transient76) : IMix76 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 76"); + singleton76.SayHi(); + transient76.SayHi(); + } +} + +public interface IMix77 +{ + void SayHi(); +} + +public class Mix77(ISingleton77 singleton77, ITransient77 transient77) : IMix77 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 77"); + singleton77.SayHi(); + transient77.SayHi(); + } +} + +public interface IMix78 +{ + void SayHi(); +} + +public class Mix78(ISingleton78 singleton78, ITransient78 transient78) : IMix78 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 78"); + singleton78.SayHi(); + transient78.SayHi(); + } +} + +public interface IMix79 +{ + void SayHi(); +} + +public class Mix79(ISingleton79 singleton79, ITransient79 transient79) : IMix79 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 79"); + singleton79.SayHi(); + transient79.SayHi(); + } +} + +public interface IMix80 +{ + void SayHi(); +} + +public class Mix80(ISingleton80 singleton80, ITransient80 transient80) : IMix80 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 80"); + singleton80.SayHi(); + transient80.SayHi(); + } +} + +public interface IMix81 +{ + void SayHi(); +} + +public class Mix81(ISingleton81 singleton81, ITransient81 transient81) : IMix81 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 81"); + singleton81.SayHi(); + transient81.SayHi(); + } +} + +public interface IMix82 +{ + void SayHi(); +} + +public class Mix82(ISingleton82 singleton82, ITransient82 transient82) : IMix82 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 82"); + singleton82.SayHi(); + transient82.SayHi(); + } +} + +public interface IMix83 +{ + void SayHi(); +} + +public class Mix83(ISingleton83 singleton83, ITransient83 transient83) : IMix83 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 83"); + singleton83.SayHi(); + transient83.SayHi(); + } +} + +public interface IMix84 +{ + void SayHi(); +} + +public class Mix84(ISingleton84 singleton84, ITransient84 transient84) : IMix84 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 84"); + singleton84.SayHi(); + transient84.SayHi(); + } +} + +public interface IMix85 +{ + void SayHi(); +} + +public class Mix85(ISingleton85 singleton85, ITransient85 transient85) : IMix85 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 85"); + singleton85.SayHi(); + transient85.SayHi(); + } +} + +public interface IMix86 +{ + void SayHi(); +} + +public class Mix86(ISingleton86 singleton86, ITransient86 transient86) : IMix86 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 86"); + singleton86.SayHi(); + transient86.SayHi(); + } +} + +public interface IMix87 +{ + void SayHi(); +} + +public class Mix87(ISingleton87 singleton87, ITransient87 transient87) : IMix87 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 87"); + singleton87.SayHi(); + transient87.SayHi(); + } +} + +public interface IMix88 +{ + void SayHi(); +} + +public class Mix88(ISingleton88 singleton88, ITransient88 transient88) : IMix88 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 88"); + singleton88.SayHi(); + transient88.SayHi(); + } +} + +public interface IMix89 +{ + void SayHi(); +} + +public class Mix89(ISingleton89 singleton89, ITransient89 transient89) : IMix89 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 89"); + singleton89.SayHi(); + transient89.SayHi(); + } +} + +public interface IMix90 +{ + void SayHi(); +} + +public class Mix90(ISingleton90 singleton90, ITransient90 transient90) : IMix90 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 90"); + singleton90.SayHi(); + transient90.SayHi(); + } +} + +public interface IMix91 +{ + void SayHi(); +} + +public class Mix91(ISingleton91 singleton91, ITransient91 transient91) : IMix91 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 91"); + singleton91.SayHi(); + transient91.SayHi(); + } +} + +public interface IMix92 +{ + void SayHi(); +} + +public class Mix92(ISingleton92 singleton92, ITransient92 transient92) : IMix92 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 92"); + singleton92.SayHi(); + transient92.SayHi(); + } +} + +public interface IMix93 +{ + void SayHi(); +} + +public class Mix93(ISingleton93 singleton93, ITransient93 transient93) : IMix93 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 93"); + singleton93.SayHi(); + transient93.SayHi(); + } +} + +public interface IMix94 +{ + void SayHi(); +} + +public class Mix94(ISingleton94 singleton94, ITransient94 transient94) : IMix94 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 94"); + singleton94.SayHi(); + transient94.SayHi(); + } +} + +public interface IMix95 +{ + void SayHi(); +} + +public class Mix95(ISingleton95 singleton95, ITransient95 transient95) : IMix95 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 95"); + singleton95.SayHi(); + transient95.SayHi(); + } +} + +public interface IMix96 +{ + void SayHi(); +} + +public class Mix96(ISingleton96 singleton96, ITransient96 transient96) : IMix96 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 96"); + singleton96.SayHi(); + transient96.SayHi(); + } +} + +public interface IMix97 +{ + void SayHi(); +} + +public class Mix97(ISingleton97 singleton97, ITransient97 transient97) : IMix97 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 97"); + singleton97.SayHi(); + transient97.SayHi(); + } +} + +public interface IMix98 +{ + void SayHi(); +} + +public class Mix98(ISingleton98 singleton98, ITransient98 transient98) : IMix98 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 98"); + singleton98.SayHi(); + transient98.SayHi(); + } +} + +public interface IMix99 +{ + void SayHi(); +} + +public class Mix99(ISingleton99 singleton99, ITransient99 transient99) : IMix99 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 99"); + singleton99.SayHi(); + transient99.SayHi(); + } +} + +public interface IMix100 +{ + void SayHi(); +} + +public class Mix100(ISingleton100 singleton100, ITransient100 transient100) : IMix100 +{ + public void SayHi() + { + Console.WriteLine($"Hello from Combined 100"); + singleton100.SayHi(); + transient100.SayHi(); + } +} + diff --git a/src/Jab.Performance/Deep/04-Mixed/DeepMixedBenchmark.cs b/src/Jab.Performance/Deep/04-Mixed/DeepMixedBenchmark.cs new file mode 100644 index 0000000..ee8d3c6 --- /dev/null +++ b/src/Jab.Performance/Deep/04-Mixed/DeepMixedBenchmark.cs @@ -0,0 +1,667 @@ +namespace Jab.Performance.Deep.Mixed; + +using BenchmarkDotNet.Attributes; +using Jab.Performance.Deep.Mixed; +using Jab.Performance.Deep.Singleton; +using Jab.Performance.Deep.Transient; +using Jab.Performance.Deep.Scoped; +using Microsoft.Extensions.DependencyInjection; +using MEDI = Microsoft.Extensions.DependencyInjection; + +[MemoryDiagnoser] +public class DeepMixedBenchmark +{ + private readonly MEDI.ServiceProvider _provider; + private readonly DeepContainerMixed _container = new(); + + public DeepMixedBenchmark() + { + var serviceCollection = new ServiceCollection(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + + _provider = serviceCollection.BuildServiceProvider(); + } + + [Params(1, 10, 100)] + public int NumbersOfCalls { get; set; } + + [Params(1, 10, 100)] + public int Deep { get; set; } + + [Benchmark(Baseline = true)] + public void Jab() + { + for (var i = 0; i < NumbersOfCalls; i++) + { + using var scope = _container.CreateScope(); + + if (Deep == 1) + scope.GetService(); + if (Deep == 10) + scope.GetService(); + if (Deep == 100) + scope.GetService(); + } + } + + [Benchmark] + public void MEDI() + { + for (var i = 0; i < NumbersOfCalls; i++) + { + using var scope = _provider.CreateScope(); + + if (Deep == 1) + scope.ServiceProvider.GetService(); + if (Deep == 10) + scope.ServiceProvider.GetService(); + if (Deep == 100) + scope.ServiceProvider.GetService(); + } + } +} + +[ServiceProvider] +[Singleton(typeof(ISingleton1), typeof(Singleton1))] +[Singleton(typeof(ISingleton2), typeof(Singleton2))] +[Singleton(typeof(ISingleton3), typeof(Singleton3))] +[Singleton(typeof(ISingleton4), typeof(Singleton4))] +[Singleton(typeof(ISingleton5), typeof(Singleton5))] +[Singleton(typeof(ISingleton6), typeof(Singleton6))] +[Singleton(typeof(ISingleton7), typeof(Singleton7))] +[Singleton(typeof(ISingleton8), typeof(Singleton8))] +[Singleton(typeof(ISingleton9), typeof(Singleton9))] +[Singleton(typeof(ISingleton10), typeof(Singleton10))] +[Singleton(typeof(ISingleton11), typeof(Singleton11))] +[Singleton(typeof(ISingleton12), typeof(Singleton12))] +[Singleton(typeof(ISingleton13), typeof(Singleton13))] +[Singleton(typeof(ISingleton14), typeof(Singleton14))] +[Singleton(typeof(ISingleton15), typeof(Singleton15))] +[Singleton(typeof(ISingleton16), typeof(Singleton16))] +[Singleton(typeof(ISingleton17), typeof(Singleton17))] +[Singleton(typeof(ISingleton18), typeof(Singleton18))] +[Singleton(typeof(ISingleton19), typeof(Singleton19))] +[Singleton(typeof(ISingleton20), typeof(Singleton20))] +[Singleton(typeof(ISingleton21), typeof(Singleton21))] +[Singleton(typeof(ISingleton22), typeof(Singleton22))] +[Singleton(typeof(ISingleton23), typeof(Singleton23))] +[Singleton(typeof(ISingleton24), typeof(Singleton24))] +[Singleton(typeof(ISingleton25), typeof(Singleton25))] +[Singleton(typeof(ISingleton26), typeof(Singleton26))] +[Singleton(typeof(ISingleton27), typeof(Singleton27))] +[Singleton(typeof(ISingleton28), typeof(Singleton28))] +[Singleton(typeof(ISingleton29), typeof(Singleton29))] +[Singleton(typeof(ISingleton30), typeof(Singleton30))] +[Singleton(typeof(ISingleton31), typeof(Singleton31))] +[Singleton(typeof(ISingleton32), typeof(Singleton32))] +[Singleton(typeof(ISingleton33), typeof(Singleton33))] +[Singleton(typeof(ISingleton34), typeof(Singleton34))] +[Singleton(typeof(ISingleton35), typeof(Singleton35))] +[Singleton(typeof(ISingleton36), typeof(Singleton36))] +[Singleton(typeof(ISingleton37), typeof(Singleton37))] +[Singleton(typeof(ISingleton38), typeof(Singleton38))] +[Singleton(typeof(ISingleton39), typeof(Singleton39))] +[Singleton(typeof(ISingleton40), typeof(Singleton40))] +[Singleton(typeof(ISingleton41), typeof(Singleton41))] +[Singleton(typeof(ISingleton42), typeof(Singleton42))] +[Singleton(typeof(ISingleton43), typeof(Singleton43))] +[Singleton(typeof(ISingleton44), typeof(Singleton44))] +[Singleton(typeof(ISingleton45), typeof(Singleton45))] +[Singleton(typeof(ISingleton46), typeof(Singleton46))] +[Singleton(typeof(ISingleton47), typeof(Singleton47))] +[Singleton(typeof(ISingleton48), typeof(Singleton48))] +[Singleton(typeof(ISingleton49), typeof(Singleton49))] +[Singleton(typeof(ISingleton50), typeof(Singleton50))] +[Singleton(typeof(ISingleton51), typeof(Singleton51))] +[Singleton(typeof(ISingleton52), typeof(Singleton52))] +[Singleton(typeof(ISingleton53), typeof(Singleton53))] +[Singleton(typeof(ISingleton54), typeof(Singleton54))] +[Singleton(typeof(ISingleton55), typeof(Singleton55))] +[Singleton(typeof(ISingleton56), typeof(Singleton56))] +[Singleton(typeof(ISingleton57), typeof(Singleton57))] +[Singleton(typeof(ISingleton58), typeof(Singleton58))] +[Singleton(typeof(ISingleton59), typeof(Singleton59))] +[Singleton(typeof(ISingleton60), typeof(Singleton60))] +[Singleton(typeof(ISingleton61), typeof(Singleton61))] +[Singleton(typeof(ISingleton62), typeof(Singleton62))] +[Singleton(typeof(ISingleton63), typeof(Singleton63))] +[Singleton(typeof(ISingleton64), typeof(Singleton64))] +[Singleton(typeof(ISingleton65), typeof(Singleton65))] +[Singleton(typeof(ISingleton66), typeof(Singleton66))] +[Singleton(typeof(ISingleton67), typeof(Singleton67))] +[Singleton(typeof(ISingleton68), typeof(Singleton68))] +[Singleton(typeof(ISingleton69), typeof(Singleton69))] +[Singleton(typeof(ISingleton70), typeof(Singleton70))] +[Singleton(typeof(ISingleton71), typeof(Singleton71))] +[Singleton(typeof(ISingleton72), typeof(Singleton72))] +[Singleton(typeof(ISingleton73), typeof(Singleton73))] +[Singleton(typeof(ISingleton74), typeof(Singleton74))] +[Singleton(typeof(ISingleton75), typeof(Singleton75))] +[Singleton(typeof(ISingleton76), typeof(Singleton76))] +[Singleton(typeof(ISingleton77), typeof(Singleton77))] +[Singleton(typeof(ISingleton78), typeof(Singleton78))] +[Singleton(typeof(ISingleton79), typeof(Singleton79))] +[Singleton(typeof(ISingleton80), typeof(Singleton80))] +[Singleton(typeof(ISingleton81), typeof(Singleton81))] +[Singleton(typeof(ISingleton82), typeof(Singleton82))] +[Singleton(typeof(ISingleton83), typeof(Singleton83))] +[Singleton(typeof(ISingleton84), typeof(Singleton84))] +[Singleton(typeof(ISingleton85), typeof(Singleton85))] +[Singleton(typeof(ISingleton86), typeof(Singleton86))] +[Singleton(typeof(ISingleton87), typeof(Singleton87))] +[Singleton(typeof(ISingleton88), typeof(Singleton88))] +[Singleton(typeof(ISingleton89), typeof(Singleton89))] +[Singleton(typeof(ISingleton90), typeof(Singleton90))] +[Singleton(typeof(ISingleton91), typeof(Singleton91))] +[Singleton(typeof(ISingleton92), typeof(Singleton92))] +[Singleton(typeof(ISingleton93), typeof(Singleton93))] +[Singleton(typeof(ISingleton94), typeof(Singleton94))] +[Singleton(typeof(ISingleton95), typeof(Singleton95))] +[Singleton(typeof(ISingleton96), typeof(Singleton96))] +[Singleton(typeof(ISingleton97), typeof(Singleton97))] +[Singleton(typeof(ISingleton98), typeof(Singleton98))] +[Singleton(typeof(ISingleton99), typeof(Singleton99))] +[Singleton(typeof(ISingleton100), typeof(Singleton100))] +[Transient(typeof(ITransient1), typeof(Transient1))] +[Transient(typeof(ITransient2), typeof(Transient2))] +[Transient(typeof(ITransient3), typeof(Transient3))] +[Transient(typeof(ITransient4), typeof(Transient4))] +[Transient(typeof(ITransient5), typeof(Transient5))] +[Transient(typeof(ITransient6), typeof(Transient6))] +[Transient(typeof(ITransient7), typeof(Transient7))] +[Transient(typeof(ITransient8), typeof(Transient8))] +[Transient(typeof(ITransient9), typeof(Transient9))] +[Transient(typeof(ITransient10), typeof(Transient10))] +[Transient(typeof(ITransient11), typeof(Transient11))] +[Transient(typeof(ITransient12), typeof(Transient12))] +[Transient(typeof(ITransient13), typeof(Transient13))] +[Transient(typeof(ITransient14), typeof(Transient14))] +[Transient(typeof(ITransient15), typeof(Transient15))] +[Transient(typeof(ITransient16), typeof(Transient16))] +[Transient(typeof(ITransient17), typeof(Transient17))] +[Transient(typeof(ITransient18), typeof(Transient18))] +[Transient(typeof(ITransient19), typeof(Transient19))] +[Transient(typeof(ITransient20), typeof(Transient20))] +[Transient(typeof(ITransient21), typeof(Transient21))] +[Transient(typeof(ITransient22), typeof(Transient22))] +[Transient(typeof(ITransient23), typeof(Transient23))] +[Transient(typeof(ITransient24), typeof(Transient24))] +[Transient(typeof(ITransient25), typeof(Transient25))] +[Transient(typeof(ITransient26), typeof(Transient26))] +[Transient(typeof(ITransient27), typeof(Transient27))] +[Transient(typeof(ITransient28), typeof(Transient28))] +[Transient(typeof(ITransient29), typeof(Transient29))] +[Transient(typeof(ITransient30), typeof(Transient30))] +[Transient(typeof(ITransient31), typeof(Transient31))] +[Transient(typeof(ITransient32), typeof(Transient32))] +[Transient(typeof(ITransient33), typeof(Transient33))] +[Transient(typeof(ITransient34), typeof(Transient34))] +[Transient(typeof(ITransient35), typeof(Transient35))] +[Transient(typeof(ITransient36), typeof(Transient36))] +[Transient(typeof(ITransient37), typeof(Transient37))] +[Transient(typeof(ITransient38), typeof(Transient38))] +[Transient(typeof(ITransient39), typeof(Transient39))] +[Transient(typeof(ITransient40), typeof(Transient40))] +[Transient(typeof(ITransient41), typeof(Transient41))] +[Transient(typeof(ITransient42), typeof(Transient42))] +[Transient(typeof(ITransient43), typeof(Transient43))] +[Transient(typeof(ITransient44), typeof(Transient44))] +[Transient(typeof(ITransient45), typeof(Transient45))] +[Transient(typeof(ITransient46), typeof(Transient46))] +[Transient(typeof(ITransient47), typeof(Transient47))] +[Transient(typeof(ITransient48), typeof(Transient48))] +[Transient(typeof(ITransient49), typeof(Transient49))] +[Transient(typeof(ITransient50), typeof(Transient50))] +[Transient(typeof(ITransient51), typeof(Transient51))] +[Transient(typeof(ITransient52), typeof(Transient52))] +[Transient(typeof(ITransient53), typeof(Transient53))] +[Transient(typeof(ITransient54), typeof(Transient54))] +[Transient(typeof(ITransient55), typeof(Transient55))] +[Transient(typeof(ITransient56), typeof(Transient56))] +[Transient(typeof(ITransient57), typeof(Transient57))] +[Transient(typeof(ITransient58), typeof(Transient58))] +[Transient(typeof(ITransient59), typeof(Transient59))] +[Transient(typeof(ITransient60), typeof(Transient60))] +[Transient(typeof(ITransient61), typeof(Transient61))] +[Transient(typeof(ITransient62), typeof(Transient62))] +[Transient(typeof(ITransient63), typeof(Transient63))] +[Transient(typeof(ITransient64), typeof(Transient64))] +[Transient(typeof(ITransient65), typeof(Transient65))] +[Transient(typeof(ITransient66), typeof(Transient66))] +[Transient(typeof(ITransient67), typeof(Transient67))] +[Transient(typeof(ITransient68), typeof(Transient68))] +[Transient(typeof(ITransient69), typeof(Transient69))] +[Transient(typeof(ITransient70), typeof(Transient70))] +[Transient(typeof(ITransient71), typeof(Transient71))] +[Transient(typeof(ITransient72), typeof(Transient72))] +[Transient(typeof(ITransient73), typeof(Transient73))] +[Transient(typeof(ITransient74), typeof(Transient74))] +[Transient(typeof(ITransient75), typeof(Transient75))] +[Transient(typeof(ITransient76), typeof(Transient76))] +[Transient(typeof(ITransient77), typeof(Transient77))] +[Transient(typeof(ITransient78), typeof(Transient78))] +[Transient(typeof(ITransient79), typeof(Transient79))] +[Transient(typeof(ITransient80), typeof(Transient80))] +[Transient(typeof(ITransient81), typeof(Transient81))] +[Transient(typeof(ITransient82), typeof(Transient82))] +[Transient(typeof(ITransient83), typeof(Transient83))] +[Transient(typeof(ITransient84), typeof(Transient84))] +[Transient(typeof(ITransient85), typeof(Transient85))] +[Transient(typeof(ITransient86), typeof(Transient86))] +[Transient(typeof(ITransient87), typeof(Transient87))] +[Transient(typeof(ITransient88), typeof(Transient88))] +[Transient(typeof(ITransient89), typeof(Transient89))] +[Transient(typeof(ITransient90), typeof(Transient90))] +[Transient(typeof(ITransient91), typeof(Transient91))] +[Transient(typeof(ITransient92), typeof(Transient92))] +[Transient(typeof(ITransient93), typeof(Transient93))] +[Transient(typeof(ITransient94), typeof(Transient94))] +[Transient(typeof(ITransient95), typeof(Transient95))] +[Transient(typeof(ITransient96), typeof(Transient96))] +[Transient(typeof(ITransient97), typeof(Transient97))] +[Transient(typeof(ITransient98), typeof(Transient98))] +[Transient(typeof(ITransient99), typeof(Transient99))] +[Transient(typeof(ITransient100), typeof(Transient100))] +[Transient(typeof(IMix1), typeof(Mix1))] +[Transient(typeof(IMix2), typeof(Mix2))] +[Transient(typeof(IMix3), typeof(Mix3))] +[Transient(typeof(IMix4), typeof(Mix4))] +[Transient(typeof(IMix5), typeof(Mix5))] +[Transient(typeof(IMix6), typeof(Mix6))] +[Transient(typeof(IMix7), typeof(Mix7))] +[Transient(typeof(IMix8), typeof(Mix8))] +[Transient(typeof(IMix9), typeof(Mix9))] +[Transient(typeof(IMix10), typeof(Mix10))] +[Transient(typeof(IMix11), typeof(Mix11))] +[Transient(typeof(IMix12), typeof(Mix12))] +[Transient(typeof(IMix13), typeof(Mix13))] +[Transient(typeof(IMix14), typeof(Mix14))] +[Transient(typeof(IMix15), typeof(Mix15))] +[Transient(typeof(IMix16), typeof(Mix16))] +[Transient(typeof(IMix17), typeof(Mix17))] +[Transient(typeof(IMix18), typeof(Mix18))] +[Transient(typeof(IMix19), typeof(Mix19))] +[Transient(typeof(IMix20), typeof(Mix20))] +[Transient(typeof(IMix21), typeof(Mix21))] +[Transient(typeof(IMix22), typeof(Mix22))] +[Transient(typeof(IMix23), typeof(Mix23))] +[Transient(typeof(IMix24), typeof(Mix24))] +[Transient(typeof(IMix25), typeof(Mix25))] +[Transient(typeof(IMix26), typeof(Mix26))] +[Transient(typeof(IMix27), typeof(Mix27))] +[Transient(typeof(IMix28), typeof(Mix28))] +[Transient(typeof(IMix29), typeof(Mix29))] +[Transient(typeof(IMix30), typeof(Mix30))] +[Transient(typeof(IMix31), typeof(Mix31))] +[Transient(typeof(IMix32), typeof(Mix32))] +[Transient(typeof(IMix33), typeof(Mix33))] +[Transient(typeof(IMix34), typeof(Mix34))] +[Transient(typeof(IMix35), typeof(Mix35))] +[Transient(typeof(IMix36), typeof(Mix36))] +[Transient(typeof(IMix37), typeof(Mix37))] +[Transient(typeof(IMix38), typeof(Mix38))] +[Transient(typeof(IMix39), typeof(Mix39))] +[Transient(typeof(IMix40), typeof(Mix40))] +[Transient(typeof(IMix41), typeof(Mix41))] +[Transient(typeof(IMix42), typeof(Mix42))] +[Transient(typeof(IMix43), typeof(Mix43))] +[Transient(typeof(IMix44), typeof(Mix44))] +[Transient(typeof(IMix45), typeof(Mix45))] +[Transient(typeof(IMix46), typeof(Mix46))] +[Transient(typeof(IMix47), typeof(Mix47))] +[Transient(typeof(IMix48), typeof(Mix48))] +[Transient(typeof(IMix49), typeof(Mix49))] +[Transient(typeof(IMix50), typeof(Mix50))] +[Transient(typeof(IMix51), typeof(Mix51))] +[Transient(typeof(IMix52), typeof(Mix52))] +[Transient(typeof(IMix53), typeof(Mix53))] +[Transient(typeof(IMix54), typeof(Mix54))] +[Transient(typeof(IMix55), typeof(Mix55))] +[Transient(typeof(IMix56), typeof(Mix56))] +[Transient(typeof(IMix57), typeof(Mix57))] +[Transient(typeof(IMix58), typeof(Mix58))] +[Transient(typeof(IMix59), typeof(Mix59))] +[Transient(typeof(IMix60), typeof(Mix60))] +[Transient(typeof(IMix61), typeof(Mix61))] +[Transient(typeof(IMix62), typeof(Mix62))] +[Transient(typeof(IMix63), typeof(Mix63))] +[Transient(typeof(IMix64), typeof(Mix64))] +[Transient(typeof(IMix65), typeof(Mix65))] +[Transient(typeof(IMix66), typeof(Mix66))] +[Transient(typeof(IMix67), typeof(Mix67))] +[Transient(typeof(IMix68), typeof(Mix68))] +[Transient(typeof(IMix69), typeof(Mix69))] +[Transient(typeof(IMix70), typeof(Mix70))] +[Transient(typeof(IMix71), typeof(Mix71))] +[Transient(typeof(IMix72), typeof(Mix72))] +[Transient(typeof(IMix73), typeof(Mix73))] +[Transient(typeof(IMix74), typeof(Mix74))] +[Transient(typeof(IMix75), typeof(Mix75))] +[Transient(typeof(IMix76), typeof(Mix76))] +[Transient(typeof(IMix77), typeof(Mix77))] +[Transient(typeof(IMix78), typeof(Mix78))] +[Transient(typeof(IMix79), typeof(Mix79))] +[Transient(typeof(IMix80), typeof(Mix80))] +[Transient(typeof(IMix81), typeof(Mix81))] +[Transient(typeof(IMix82), typeof(Mix82))] +[Transient(typeof(IMix83), typeof(Mix83))] +[Transient(typeof(IMix84), typeof(Mix84))] +[Transient(typeof(IMix85), typeof(Mix85))] +[Transient(typeof(IMix86), typeof(Mix86))] +[Transient(typeof(IMix87), typeof(Mix87))] +[Transient(typeof(IMix88), typeof(Mix88))] +[Transient(typeof(IMix89), typeof(Mix89))] +[Transient(typeof(IMix90), typeof(Mix90))] +[Transient(typeof(IMix91), typeof(Mix91))] +[Transient(typeof(IMix92), typeof(Mix92))] +[Transient(typeof(IMix93), typeof(Mix93))] +[Transient(typeof(IMix94), typeof(Mix94))] +[Transient(typeof(IMix95), typeof(Mix95))] +[Transient(typeof(IMix96), typeof(Mix96))] +[Transient(typeof(IMix97), typeof(Mix97))] +[Transient(typeof(IMix98), typeof(Mix98))] +[Transient(typeof(IMix99), typeof(Mix99))] +[Transient(typeof(IMix100), typeof(Mix100))] + +internal partial class DeepContainerMixed +{ +} \ No newline at end of file From 757cf041431c7a553ddff18a543988088cc7abbc Mon Sep 17 00:00:00 2001 From: Rafael Sliveira Cordeiro Date: Fri, 15 Dec 2023 22:06:37 -0800 Subject: [PATCH 07/16] Rename Benchmarks --- .../{SingletonBenchmark.cs => BasicSingletonBenchmark.cs} | 4 ++-- .../{TransientBenchmark.cs => BasicTransientBenchmark.cs} | 4 ++-- .../03-Scoped/{ScopedBenchmark.cs => BasicScopedBenchmark.cs} | 4 ++-- .../04-Mixed/{MixedBenchmark.cs => BasicMixedBenchmark.cs} | 4 ++-- .../{ComplexBenchmark.cs => BasicComplexBenchmark.cs} | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) rename src/Jab.Performance/Basic/01-Singleton/{SingletonBenchmark.cs => BasicSingletonBenchmark.cs} (96%) rename src/Jab.Performance/Basic/02-Transient/{TransientBenchmark.cs => BasicTransientBenchmark.cs} (96%) rename src/Jab.Performance/Basic/03-Scoped/{ScopedBenchmark.cs => BasicScopedBenchmark.cs} (96%) rename src/Jab.Performance/Basic/04-Mixed/{MixedBenchmark.cs => BasicMixedBenchmark.cs} (97%) rename src/Jab.Performance/Basic/05-Complex/{ComplexBenchmark.cs => BasicComplexBenchmark.cs} (97%) diff --git a/src/Jab.Performance/Basic/01-Singleton/SingletonBenchmark.cs b/src/Jab.Performance/Basic/01-Singleton/BasicSingletonBenchmark.cs similarity index 96% rename from src/Jab.Performance/Basic/01-Singleton/SingletonBenchmark.cs rename to src/Jab.Performance/Basic/01-Singleton/BasicSingletonBenchmark.cs index 4b358b5..115a53c 100644 --- a/src/Jab.Performance/Basic/01-Singleton/SingletonBenchmark.cs +++ b/src/Jab.Performance/Basic/01-Singleton/BasicSingletonBenchmark.cs @@ -6,12 +6,12 @@ [MemoryDiagnoser] -public class SingletonBenchmark +public class BasicSingletonBenchmark { private readonly MEDI.ServiceProvider _provider; private readonly ContainerSingleton _container = new(); - public SingletonBenchmark() + public BasicSingletonBenchmark() { var serviceCollection = new ServiceCollection(); serviceCollection.AddSingleton(); diff --git a/src/Jab.Performance/Basic/02-Transient/TransientBenchmark.cs b/src/Jab.Performance/Basic/02-Transient/BasicTransientBenchmark.cs similarity index 96% rename from src/Jab.Performance/Basic/02-Transient/TransientBenchmark.cs rename to src/Jab.Performance/Basic/02-Transient/BasicTransientBenchmark.cs index aa77029..9893128 100644 --- a/src/Jab.Performance/Basic/02-Transient/TransientBenchmark.cs +++ b/src/Jab.Performance/Basic/02-Transient/BasicTransientBenchmark.cs @@ -6,12 +6,12 @@ [MemoryDiagnoser] -public class TransientBenchmark +public class BasicTransientBenchmark { private readonly MEDI.ServiceProvider _provider; private readonly ContainerTransient _container = new(); - public TransientBenchmark() + public BasicTransientBenchmark() { var serviceCollection = new ServiceCollection(); serviceCollection.AddTransient(); diff --git a/src/Jab.Performance/Basic/03-Scoped/ScopedBenchmark.cs b/src/Jab.Performance/Basic/03-Scoped/BasicScopedBenchmark.cs similarity index 96% rename from src/Jab.Performance/Basic/03-Scoped/ScopedBenchmark.cs rename to src/Jab.Performance/Basic/03-Scoped/BasicScopedBenchmark.cs index 2e01868..e242709 100644 --- a/src/Jab.Performance/Basic/03-Scoped/ScopedBenchmark.cs +++ b/src/Jab.Performance/Basic/03-Scoped/BasicScopedBenchmark.cs @@ -6,12 +6,12 @@ [MemoryDiagnoser] -public class ScopedBenchmark +public class BasicScopedBenchmark { private readonly MEDI.ServiceProvider _provider; private readonly ContainerScoped _container = new(); - public ScopedBenchmark() + public BasicScopedBenchmark() { var serviceCollection = new ServiceCollection(); serviceCollection.AddScoped(); diff --git a/src/Jab.Performance/Basic/04-Mixed/MixedBenchmark.cs b/src/Jab.Performance/Basic/04-Mixed/BasicMixedBenchmark.cs similarity index 97% rename from src/Jab.Performance/Basic/04-Mixed/MixedBenchmark.cs rename to src/Jab.Performance/Basic/04-Mixed/BasicMixedBenchmark.cs index bc6bde9..69bf545 100644 --- a/src/Jab.Performance/Basic/04-Mixed/MixedBenchmark.cs +++ b/src/Jab.Performance/Basic/04-Mixed/BasicMixedBenchmark.cs @@ -7,12 +7,12 @@ using MEDI = Microsoft.Extensions.DependencyInjection; [MemoryDiagnoser] -public class MixedBenchmark +public class BasicMixedBenchmark { private readonly MEDI.ServiceProvider _provider; private readonly ContainerMixed _container = new(); - public MixedBenchmark() + public BasicMixedBenchmark() { var serviceCollection = new ServiceCollection(); serviceCollection.AddTransient(); diff --git a/src/Jab.Performance/Basic/05-Complex/ComplexBenchmark.cs b/src/Jab.Performance/Basic/05-Complex/BasicComplexBenchmark.cs similarity index 97% rename from src/Jab.Performance/Basic/05-Complex/ComplexBenchmark.cs rename to src/Jab.Performance/Basic/05-Complex/BasicComplexBenchmark.cs index e46a390..fa4c34e 100644 --- a/src/Jab.Performance/Basic/05-Complex/ComplexBenchmark.cs +++ b/src/Jab.Performance/Basic/05-Complex/BasicComplexBenchmark.cs @@ -10,12 +10,12 @@ [MemoryDiagnoser] -public class ComplexBenchmark +public class BasicComplexBenchmark { private readonly MEDI.ServiceProvider _provider; private readonly ContainerComplex _container = new(); - public ComplexBenchmark() + public BasicComplexBenchmark() { var serviceCollection = new ServiceCollection(); serviceCollection.AddScoped(); From 5b74cd33b57ccfe715800b68f4a7d6595c9d3b11 Mon Sep 17 00:00:00 2001 From: Rafael Sliveira Cordeiro Date: Fri, 15 Dec 2023 22:06:58 -0800 Subject: [PATCH 08/16] Add Startup Time Benchmarks --- .../Startup/StartupComplexBenchmark.cs | 63 +++++++++++++++++++ .../Startup/StartupMixedBenchmark.cs | 50 +++++++++++++++ .../Startup/StartupScopedBenchmark.cs | 37 +++++++++++ .../Startup/StartupSingletonBenchmark.cs | 36 +++++++++++ .../Startup/StartupTransientBenchmark.cs | 37 +++++++++++ 5 files changed, 223 insertions(+) create mode 100644 src/Jab.Performance/Startup/StartupComplexBenchmark.cs create mode 100644 src/Jab.Performance/Startup/StartupMixedBenchmark.cs create mode 100644 src/Jab.Performance/Startup/StartupScopedBenchmark.cs create mode 100644 src/Jab.Performance/Startup/StartupSingletonBenchmark.cs create mode 100644 src/Jab.Performance/Startup/StartupTransientBenchmark.cs diff --git a/src/Jab.Performance/Startup/StartupComplexBenchmark.cs b/src/Jab.Performance/Startup/StartupComplexBenchmark.cs new file mode 100644 index 0000000..4b98bc3 --- /dev/null +++ b/src/Jab.Performance/Startup/StartupComplexBenchmark.cs @@ -0,0 +1,63 @@ +namespace Jab.Performance.Startup; + +using BenchmarkDotNet.Attributes; +using Jab; +using Jab.Performance.Basic.Complex; +using Jab.Performance.Basic.Mixed; +using Jab.Performance.Basic.Singleton; +using Jab.Performance.Basic.Transient; +using Microsoft.Extensions.DependencyInjection; + +[MemoryDiagnoser] +public class StartupComplexBenchmark +{ + [Benchmark(Baseline = true)] + public void Jab() + { + var provider = new ContainerStartupComplex(); + var _ = provider.GetService(); + } + + [Benchmark] + public void MEDI() + { + var serviceCollection = new ServiceCollection(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + var provider = serviceCollection.BuildServiceProvider(); + var _ = provider.GetService(); + } +} + +[ServiceProvider] +[Scoped(typeof(IComplex1), typeof(Complex1))] +[Scoped(typeof(IComplex2), typeof(Complex2))] +[Scoped(typeof(IComplex3), typeof(Complex3))] +[Transient(typeof(IService1), typeof(Service1))] +[Transient(typeof(IService2), typeof(Service2))] +[Transient(typeof(IService3), typeof(Service3))] +[Transient(typeof(IMix1), typeof(Mix1))] +[Transient(typeof(IMix2), typeof(Mix2))] +[Transient(typeof(IMix3), typeof(Mix3))] +[Transient(typeof(ITransient1), typeof(Transient1))] +[Transient(typeof(ITransient2), typeof(Transient2))] +[Transient(typeof(ITransient3), typeof(Transient3))] +[Singleton(typeof(ISingleton1), typeof(Singleton1))] +[Singleton(typeof(ISingleton2), typeof(Singleton2))] +[Singleton(typeof(ISingleton3), typeof(Singleton3))] +internal partial class ContainerStartupComplex +{ +} \ No newline at end of file diff --git a/src/Jab.Performance/Startup/StartupMixedBenchmark.cs b/src/Jab.Performance/Startup/StartupMixedBenchmark.cs new file mode 100644 index 0000000..07215bf --- /dev/null +++ b/src/Jab.Performance/Startup/StartupMixedBenchmark.cs @@ -0,0 +1,50 @@ +namespace Jab.Performance.Startup; + +using BenchmarkDotNet.Attributes; +using Jab; +using Jab.Performance.Basic.Singleton; +using Jab.Performance.Basic.Transient; +using Jab.Performance.Basic.Mixed; +using Microsoft.Extensions.DependencyInjection; + +[MemoryDiagnoser] +public class StartupMixedBenchmark +{ + [Benchmark(Baseline = true)] + public void Jab() + { + var provider = new ContainerStartupMixed(); + var _ = provider.GetService(); + } + + [Benchmark] + public void MEDI() + { + var serviceCollection = new ServiceCollection(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + var provider = serviceCollection.BuildServiceProvider(); + var _ = provider.GetService(); + } +} + +[ServiceProvider] +[Transient(typeof(IMix1), typeof(Mix1))] +[Transient(typeof(IMix2), typeof(Mix2))] +[Transient(typeof(IMix3), typeof(Mix3))] +[Transient(typeof(ITransient1), typeof(Transient1))] +[Transient(typeof(ITransient2), typeof(Transient2))] +[Transient(typeof(ITransient3), typeof(Transient3))] +[Singleton(typeof(ISingleton1), typeof(Singleton1))] +[Singleton(typeof(ISingleton2), typeof(Singleton2))] +[Singleton(typeof(ISingleton3), typeof(Singleton3))] +internal partial class ContainerStartupMixed +{ +} \ No newline at end of file diff --git a/src/Jab.Performance/Startup/StartupScopedBenchmark.cs b/src/Jab.Performance/Startup/StartupScopedBenchmark.cs new file mode 100644 index 0000000..e0b5145 --- /dev/null +++ b/src/Jab.Performance/Startup/StartupScopedBenchmark.cs @@ -0,0 +1,37 @@ +namespace Jab.Performance.Startup; + +using BenchmarkDotNet.Attributes; +using Jab; +using Jab.Performance.Basic.Scoped; +using Microsoft.Extensions.DependencyInjection; + +[MemoryDiagnoser] +public class StartupScopedBenchmark +{ + [Benchmark(Baseline = true)] + public void Jab() + { + var provider = new ContainerStartupScoped(); + var _ = provider.GetService(); + } + + [Benchmark] + public void MEDI() + { + var serviceCollection = new ServiceCollection(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + var provider = serviceCollection.BuildServiceProvider(); + var _ = provider.GetService(); + } + +} + +[ServiceProvider] +[Scoped(typeof(IScoped1), typeof(Scoped1))] +[Scoped(typeof(IScoped2), typeof(Scoped2))] +[Scoped(typeof(IScoped3), typeof(Scoped3))] +internal partial class ContainerStartupScoped +{ +} \ No newline at end of file diff --git a/src/Jab.Performance/Startup/StartupSingletonBenchmark.cs b/src/Jab.Performance/Startup/StartupSingletonBenchmark.cs new file mode 100644 index 0000000..341dafe --- /dev/null +++ b/src/Jab.Performance/Startup/StartupSingletonBenchmark.cs @@ -0,0 +1,36 @@ +namespace Jab.Performance.Startup; + +using BenchmarkDotNet.Attributes; +using Jab; +using Jab.Performance.Basic.Singleton; +using Microsoft.Extensions.DependencyInjection; + +[MemoryDiagnoser] +public class StartupSingletonBenchmark +{ + [Benchmark(Baseline = true)] + public void Jab() + { + var provider = new ContainerStartupSingleton(); + var _ = provider.GetService(); + } + + [Benchmark] + public void MEDI() + { + var serviceCollection = new ServiceCollection(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); + var provider = serviceCollection.BuildServiceProvider(); + var _ = provider.GetService(); + } +} + +[ServiceProvider] +[Singleton(typeof(ISingleton1), typeof(Singleton1))] +[Singleton(typeof(ISingleton2), typeof(Singleton2))] +[Singleton(typeof(ISingleton3), typeof(Singleton3))] +internal partial class ContainerStartupSingleton +{ +} \ No newline at end of file diff --git a/src/Jab.Performance/Startup/StartupTransientBenchmark.cs b/src/Jab.Performance/Startup/StartupTransientBenchmark.cs new file mode 100644 index 0000000..67c39e4 --- /dev/null +++ b/src/Jab.Performance/Startup/StartupTransientBenchmark.cs @@ -0,0 +1,37 @@ +namespace Jab.Performance.Startup; + +using BenchmarkDotNet.Attributes; +using Jab; +using Jab.Performance.Basic.Transient; +using Microsoft.Extensions.DependencyInjection; + +[MemoryDiagnoser] +public class StartupTransientBenchmark +{ + [Benchmark(Baseline = true)] + public void Jab() + { + var provider = new ContainerStartupTransient(); + var _ = provider.GetService(); + } + + [Benchmark] + public void MEDI() + { + var serviceCollection = new ServiceCollection(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + var provider = serviceCollection.BuildServiceProvider(); + var _ = provider.GetService(); + } + +} + +[ServiceProvider] +[Transient(typeof(ITransient1), typeof(Transient1))] +[Transient(typeof(ITransient2), typeof(Transient2))] +[Transient(typeof(ITransient3), typeof(Transient3))] +internal partial class ContainerStartupTransient +{ +} \ No newline at end of file From 9504593090c72ba43659a4d9cd2aa99e666f39a6 Mon Sep 17 00:00:00 2001 From: Rafael Sliveira Cordeiro Date: Fri, 15 Dec 2023 22:07:09 -0800 Subject: [PATCH 09/16] Remove Old Benchmarks --- src/Jab.Performance/Container.cs | 8 -------- src/Jab.Performance/GetService.cs | 26 -------------------------- src/Jab.Performance/IService.cs | 7 ------- src/Jab.Performance/Service.cs | 6 ------ src/Jab.Performance/StartupTime.cs | 25 ------------------------- 5 files changed, 72 deletions(-) delete mode 100644 src/Jab.Performance/Container.cs delete mode 100644 src/Jab.Performance/GetService.cs delete mode 100644 src/Jab.Performance/IService.cs delete mode 100644 src/Jab.Performance/Service.cs delete mode 100644 src/Jab.Performance/StartupTime.cs diff --git a/src/Jab.Performance/Container.cs b/src/Jab.Performance/Container.cs deleted file mode 100644 index 5f11f51..0000000 --- a/src/Jab.Performance/Container.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Jab.Performance -{ - [ServiceProvider] - [Transient(typeof(IService), typeof(Service))] - internal partial class Container - { - } -} \ No newline at end of file diff --git a/src/Jab.Performance/GetService.cs b/src/Jab.Performance/GetService.cs deleted file mode 100644 index 3d1820c..0000000 --- a/src/Jab.Performance/GetService.cs +++ /dev/null @@ -1,26 +0,0 @@ -using BenchmarkDotNet.Attributes; -using Microsoft.Extensions.DependencyInjection; - -namespace Jab.Performance -{ - [MemoryDiagnoser] - public class GetService - { - private ServiceProvider _provider; - private Container _container; - - public GetService() - { - var serviceCollection = new ServiceCollection(); - serviceCollection.AddTransient(); - _provider = serviceCollection.BuildServiceProvider(); - _container = new Container(); - } - - [Benchmark] - public void MEDI() => _provider.GetService(); - - [Benchmark(Baseline = true)] - public void Jab() => _container.GetService(); - } -} \ No newline at end of file diff --git a/src/Jab.Performance/IService.cs b/src/Jab.Performance/IService.cs deleted file mode 100644 index b96d46e..0000000 --- a/src/Jab.Performance/IService.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Jab.Performance -{ - internal interface IService - { - - } -} \ No newline at end of file diff --git a/src/Jab.Performance/Service.cs b/src/Jab.Performance/Service.cs deleted file mode 100644 index 85ab018..0000000 --- a/src/Jab.Performance/Service.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Jab.Performance -{ - internal class Service: IService - { - } -} \ No newline at end of file diff --git a/src/Jab.Performance/StartupTime.cs b/src/Jab.Performance/StartupTime.cs deleted file mode 100644 index 3896700..0000000 --- a/src/Jab.Performance/StartupTime.cs +++ /dev/null @@ -1,25 +0,0 @@ -using BenchmarkDotNet.Attributes; -using Microsoft.Extensions.DependencyInjection; - -namespace Jab.Performance -{ - [MemoryDiagnoser] - public class StartupTime - { - [Benchmark] - public void MEDI() - { - var serviceCollection = new ServiceCollection(); - serviceCollection.AddTransient(); - var provider = serviceCollection.BuildServiceProvider(); - provider.GetService(); - } - - [Benchmark(Baseline = true)] - public void Jab() - { - var provider = new Container(); - provider.GetService(); - } - } -} \ No newline at end of file From 1d963cf91074162518c15bc0e6c919fa69a6b667 Mon Sep 17 00:00:00 2001 From: Rafael Sliveira Cordeiro Date: Sat, 16 Dec 2023 22:39:37 -0800 Subject: [PATCH 10/16] Update StartupBenchmark --- ...rk.cs => StartupBenchmark-01-Singleton.cs} | 15 +++++++------- ...hmark.cs => StartupBenchmark-02-Scoped.cs} | 15 +++++++------- ...rk.cs => StartupBenchmark-03-Transient.cs} | 15 +++++++------- ...chmark.cs => StartupBenchmark-04-Mixed.cs} | 15 +++++++------- ...mark.cs => StartupBenchmark-05-Complex.cs} | 16 +++++++-------- .../Startup/StartupBenchmark.cs | 20 +++++++++++++++++++ 6 files changed, 56 insertions(+), 40 deletions(-) rename src/Jab.Performance/Startup/{StartupSingletonBenchmark.cs => StartupBenchmark-01-Singleton.cs} (68%) rename src/Jab.Performance/Startup/{StartupScopedBenchmark.cs => StartupBenchmark-02-Scoped.cs} (67%) rename src/Jab.Performance/Startup/{StartupTransientBenchmark.cs => StartupBenchmark-03-Transient.cs} (68%) rename src/Jab.Performance/Startup/{StartupMixedBenchmark.cs => StartupBenchmark-04-Mixed.cs} (80%) rename src/Jab.Performance/Startup/{StartupComplexBenchmark.cs => StartupBenchmark-05-Complex.cs} (84%) create mode 100644 src/Jab.Performance/Startup/StartupBenchmark.cs diff --git a/src/Jab.Performance/Startup/StartupSingletonBenchmark.cs b/src/Jab.Performance/Startup/StartupBenchmark-01-Singleton.cs similarity index 68% rename from src/Jab.Performance/Startup/StartupSingletonBenchmark.cs rename to src/Jab.Performance/Startup/StartupBenchmark-01-Singleton.cs index 341dafe..253b8cc 100644 --- a/src/Jab.Performance/Startup/StartupSingletonBenchmark.cs +++ b/src/Jab.Performance/Startup/StartupBenchmark-01-Singleton.cs @@ -5,25 +5,24 @@ using Jab.Performance.Basic.Singleton; using Microsoft.Extensions.DependencyInjection; -[MemoryDiagnoser] -public class StartupSingletonBenchmark +public partial class StartupBenchmark { - [Benchmark(Baseline = true)] - public void Jab() + [Benchmark(Baseline = true), BenchmarkCategory("01", "Singleton", "Jab")] + public IServiceProvider Jab_Singleton() { var provider = new ContainerStartupSingleton(); - var _ = provider.GetService(); + return provider.GetService(); } - [Benchmark] - public void MEDI() + [Benchmark, BenchmarkCategory("01", "Singleton", "MEDI")] + public IServiceProvider MEDI_Singleton() { var serviceCollection = new ServiceCollection(); serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); var provider = serviceCollection.BuildServiceProvider(); - var _ = provider.GetService(); + return provider.GetService()!; } } diff --git a/src/Jab.Performance/Startup/StartupScopedBenchmark.cs b/src/Jab.Performance/Startup/StartupBenchmark-02-Scoped.cs similarity index 67% rename from src/Jab.Performance/Startup/StartupScopedBenchmark.cs rename to src/Jab.Performance/Startup/StartupBenchmark-02-Scoped.cs index e0b5145..d63ab5b 100644 --- a/src/Jab.Performance/Startup/StartupScopedBenchmark.cs +++ b/src/Jab.Performance/Startup/StartupBenchmark-02-Scoped.cs @@ -5,25 +5,24 @@ using Jab.Performance.Basic.Scoped; using Microsoft.Extensions.DependencyInjection; -[MemoryDiagnoser] -public class StartupScopedBenchmark +public partial class StartupBenchmark { - [Benchmark(Baseline = true)] - public void Jab() + [Benchmark(Baseline = true), BenchmarkCategory("02", "Scoped", "Jab")] + public IServiceProvider Jab_Scoped() { var provider = new ContainerStartupScoped(); - var _ = provider.GetService(); + return provider.GetService(); } - [Benchmark] - public void MEDI() + [Benchmark, BenchmarkCategory("02", "Scoped", "MEDI")] + public IServiceProvider MEDI_Scoped() { var serviceCollection = new ServiceCollection(); serviceCollection.AddScoped(); serviceCollection.AddScoped(); serviceCollection.AddScoped(); var provider = serviceCollection.BuildServiceProvider(); - var _ = provider.GetService(); + return provider.GetService()!; } } diff --git a/src/Jab.Performance/Startup/StartupTransientBenchmark.cs b/src/Jab.Performance/Startup/StartupBenchmark-03-Transient.cs similarity index 68% rename from src/Jab.Performance/Startup/StartupTransientBenchmark.cs rename to src/Jab.Performance/Startup/StartupBenchmark-03-Transient.cs index 67c39e4..0adc64c 100644 --- a/src/Jab.Performance/Startup/StartupTransientBenchmark.cs +++ b/src/Jab.Performance/Startup/StartupBenchmark-03-Transient.cs @@ -5,25 +5,24 @@ using Jab.Performance.Basic.Transient; using Microsoft.Extensions.DependencyInjection; -[MemoryDiagnoser] -public class StartupTransientBenchmark +public partial class StartupBenchmark { - [Benchmark(Baseline = true)] - public void Jab() + [Benchmark(Baseline = true), BenchmarkCategory("03", "Transient", "Jab")] + public IServiceProvider Jab_Transient() { var provider = new ContainerStartupTransient(); - var _ = provider.GetService(); + return provider.GetService(); } - [Benchmark] - public void MEDI() + [Benchmark, BenchmarkCategory("03", "Transient", "MEDI")] + public IServiceProvider MEDI_Transient() { var serviceCollection = new ServiceCollection(); serviceCollection.AddTransient(); serviceCollection.AddTransient(); serviceCollection.AddTransient(); var provider = serviceCollection.BuildServiceProvider(); - var _ = provider.GetService(); + return provider.GetService()!; } } diff --git a/src/Jab.Performance/Startup/StartupMixedBenchmark.cs b/src/Jab.Performance/Startup/StartupBenchmark-04-Mixed.cs similarity index 80% rename from src/Jab.Performance/Startup/StartupMixedBenchmark.cs rename to src/Jab.Performance/Startup/StartupBenchmark-04-Mixed.cs index 07215bf..82cee82 100644 --- a/src/Jab.Performance/Startup/StartupMixedBenchmark.cs +++ b/src/Jab.Performance/Startup/StartupBenchmark-04-Mixed.cs @@ -7,18 +7,17 @@ using Jab.Performance.Basic.Mixed; using Microsoft.Extensions.DependencyInjection; -[MemoryDiagnoser] -public class StartupMixedBenchmark +public partial class StartupBenchmark { - [Benchmark(Baseline = true)] - public void Jab() + [Benchmark(Baseline = true), BenchmarkCategory("04", "Mixed", "Jab")] + public IServiceProvider Jab_Mixed() { var provider = new ContainerStartupMixed(); - var _ = provider.GetService(); + return provider.GetService(); } - [Benchmark] - public void MEDI() + [Benchmark, BenchmarkCategory("04", "Mixed", "MEDI")] + public IServiceProvider MEDI_Mixed() { var serviceCollection = new ServiceCollection(); serviceCollection.AddTransient(); @@ -31,7 +30,7 @@ public void MEDI() serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); var provider = serviceCollection.BuildServiceProvider(); - var _ = provider.GetService(); + return provider.GetService()!; } } diff --git a/src/Jab.Performance/Startup/StartupComplexBenchmark.cs b/src/Jab.Performance/Startup/StartupBenchmark-05-Complex.cs similarity index 84% rename from src/Jab.Performance/Startup/StartupComplexBenchmark.cs rename to src/Jab.Performance/Startup/StartupBenchmark-05-Complex.cs index 4b98bc3..4ebf5e6 100644 --- a/src/Jab.Performance/Startup/StartupComplexBenchmark.cs +++ b/src/Jab.Performance/Startup/StartupBenchmark-05-Complex.cs @@ -1,6 +1,7 @@ namespace Jab.Performance.Startup; using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Configs; using Jab; using Jab.Performance.Basic.Complex; using Jab.Performance.Basic.Mixed; @@ -8,18 +9,17 @@ using Jab.Performance.Basic.Transient; using Microsoft.Extensions.DependencyInjection; -[MemoryDiagnoser] -public class StartupComplexBenchmark +public partial class StartupBenchmark { - [Benchmark(Baseline = true)] - public void Jab() + [Benchmark(Baseline = true), BenchmarkCategory("05", "Complex", "Jab")] + public IServiceProvider Jab_Complex() { var provider = new ContainerStartupComplex(); - var _ = provider.GetService(); + return provider.GetService(); } - [Benchmark] - public void MEDI() + [Benchmark, BenchmarkCategory("05", "Complex", "MEDI")] + public IServiceProvider MEDI_Complex() { var serviceCollection = new ServiceCollection(); serviceCollection.AddScoped(); @@ -38,7 +38,7 @@ public void MEDI() serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); var provider = serviceCollection.BuildServiceProvider(); - var _ = provider.GetService(); + return provider.GetService()!; } } diff --git a/src/Jab.Performance/Startup/StartupBenchmark.cs b/src/Jab.Performance/Startup/StartupBenchmark.cs new file mode 100644 index 0000000..95f7546 --- /dev/null +++ b/src/Jab.Performance/Startup/StartupBenchmark.cs @@ -0,0 +1,20 @@ +namespace Jab.Performance.Startup; + +using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Configs; + +[ShortRunJob] +[Config(typeof(Config))] +[GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByJob, BenchmarkLogicalGroupRule.ByCategory, BenchmarkLogicalGroupRule.ByMethod, BenchmarkLogicalGroupRule.ByParams)] +[MemoryDiagnoser]//, CategoriesColumn] +public partial class StartupBenchmark +{ + private class Config : ManualConfig + { + public Config() + { + this.HideColumns("Ratio", "RatioSD"); + } + } + +} From cc8613d7a90825c34959ca4640704461defe1915 Mon Sep 17 00:00:00 2001 From: Rafael Sliveira Cordeiro Date: Sat, 16 Dec 2023 22:52:15 -0800 Subject: [PATCH 11/16] Update Benchmark Results --- README.md | 23 +++++++++++---- ....Startup.StartupBenchmark-report-github.md | 28 +++++++++++++++++++ 2 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 doc/benchmark/Jab.Performance.Startup.StartupBenchmark-report-github.md diff --git a/README.md b/README.md index c127c1d..789f4ca 100644 --- a/README.md +++ b/README.md @@ -224,16 +224,29 @@ Sample Jab usage in console application can be found in [src/samples/ConsoleSamp The performance benchmark project is available in [src/Jab.Performance/](src/Jab.Performance/). +And the results in [docs/benchmark/](docs/benchmark/) + ### Startup time The startup time benchmark measures time between application startup and the first service being resolved. ``` -| Method | Mean | Error | StdDev | Ratio | RatioSD | Gen 0 | Gen 1 | Gen 2 | Allocated | -|------- |------------:|----------:|----------:|-------:|--------:|-------:|-------:|------:|----------:| -| MEDI | 2,437.88 ns | 14.565 ns | 12.163 ns | 220.91 | 2.72 | 0.6332 | 0.0114 | - | 6632 B | -| Jab | 11.03 ns | 0.158 ns | 0.123 ns | 1.00 | 0.00 | 0.0046 | - | - | 48 B | -``` +| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated | Alloc Ratio | +|--------------- |-------------:|-------------:|------------:|-------:|-------:|----------:|------------:| +| Jab_Singleton | 8.629 ns | 7.745 ns | 0.4245 ns | 0.0067 | - | 56 B | 1.00 | +| MEDI_Singleton | 2,177.868 ns | 4,000.891 ns | 219.3023 ns | 0.8640 | 0.2155 | 7232 B | ? | +| | | | | | | | | +| Jab_Scoped | 7.988 ns | 6.414 ns | 0.3515 ns | 0.0038 | - | 32 B | 1.00 | +| MEDI_Scoped | 1,897.986 ns | 1,878.578 ns | 102.9712 ns | 0.8640 | 0.2155 | 7232 B | ? | +| | | | | | | | | +| Jab_Transient | 8.279 ns | 6.090 ns | 0.3338 ns | 0.0038 | - | 32 B | 1.00 | +| MEDI_Transient | 1,864.865 ns | 2,109.098 ns | 115.6068 ns | 0.8640 | 0.2155 | 7232 B | ? | +| | | | | | | | | +| Jab_Mixed | 10.311 ns | 7.034 ns | 0.3856 ns | 0.0067 | - | 56 B | 1.00 | +| MEDI_Mixed | 2,475.742 ns | 2,388.959 ns | 130.9469 ns | 1.0834 | 0.2689 | 9064 B | ? | +| | | | | | | | | +| Jab_Complex | 14.194 ns | 24.354 ns | 1.3349 ns | 0.0067 | - | 56 B | 1.00 | +| MEDI_Complex | 2,382.348 ns | 1,215.594 ns | 66.6308 ns | 1.1330 | 0.2823 | 9496 B | ? |``` ### GetService diff --git a/doc/benchmark/Jab.Performance.Startup.StartupBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Startup.StartupBenchmark-report-github.md new file mode 100644 index 0000000..7626ecd --- /dev/null +++ b/doc/benchmark/Jab.Performance.Startup.StartupBenchmark-report-github.md @@ -0,0 +1,28 @@ +``` + +BenchmarkDotNet v0.13.10, Windows 10 (10.0.19045.3803/22H2/2022Update) +AMD Ryzen 9 3900XT, 1 CPU, 24 logical and 12 physical cores +.NET SDK 8.0.100 + [Host] : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + ShortRun : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + +Job=ShortRun IterationCount=3 LaunchCount=1 +WarmupCount=3 + +``` +| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated | Alloc Ratio | +|--------------- |-------------:|-------------:|------------:|-------:|-------:|----------:|------------:| +| Jab_Singleton | 8.629 ns | 7.745 ns | 0.4245 ns | 0.0067 | - | 56 B | 1.00 | +| MEDI_Singleton | 2,177.868 ns | 4,000.891 ns | 219.3023 ns | 0.8640 | 0.2155 | 7232 B | ? | +| | | | | | | | | +| Jab_Scoped | 7.988 ns | 6.414 ns | 0.3515 ns | 0.0038 | - | 32 B | 1.00 | +| MEDI_Scoped | 1,897.986 ns | 1,878.578 ns | 102.9712 ns | 0.8640 | 0.2155 | 7232 B | ? | +| | | | | | | | | +| Jab_Transient | 8.279 ns | 6.090 ns | 0.3338 ns | 0.0038 | - | 32 B | 1.00 | +| MEDI_Transient | 1,864.865 ns | 2,109.098 ns | 115.6068 ns | 0.8640 | 0.2155 | 7232 B | ? | +| | | | | | | | | +| Jab_Mixed | 10.311 ns | 7.034 ns | 0.3856 ns | 0.0067 | - | 56 B | 1.00 | +| MEDI_Mixed | 2,475.742 ns | 2,388.959 ns | 130.9469 ns | 1.0834 | 0.2689 | 9064 B | ? | +| | | | | | | | | +| Jab_Complex | 14.194 ns | 24.354 ns | 1.3349 ns | 0.0067 | - | 56 B | 1.00 | +| MEDI_Complex | 2,382.348 ns | 1,215.594 ns | 66.6308 ns | 1.1330 | 0.2823 | 9496 B | ? | From b3f41c5c31fd4f0138e6b81f45fa5ccb41856649 Mon Sep 17 00:00:00 2001 From: Rafael Sliveira Cordeiro Date: Sat, 16 Dec 2023 22:59:08 -0800 Subject: [PATCH 12/16] Fix Format --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 789f4ca..751fc21 100644 --- a/README.md +++ b/README.md @@ -246,7 +246,8 @@ The startup time benchmark measures time between application startup and the fir | MEDI_Mixed | 2,475.742 ns | 2,388.959 ns | 130.9469 ns | 1.0834 | 0.2689 | 9064 B | ? | | | | | | | | | | | Jab_Complex | 14.194 ns | 24.354 ns | 1.3349 ns | 0.0067 | - | 56 B | 1.00 | -| MEDI_Complex | 2,382.348 ns | 1,215.594 ns | 66.6308 ns | 1.1330 | 0.2823 | 9496 B | ? |``` +| MEDI_Complex | 2,382.348 ns | 1,215.594 ns | 66.6308 ns | 1.1330 | 0.2823 | 9496 B | ? | +``` ### GetService From 241947669f645e1277eeddc810bc487eefeddcfb Mon Sep 17 00:00:00 2001 From: Rafael Sliveira Cordeiro Date: Mon, 15 Jan 2024 21:55:06 -0800 Subject: [PATCH 13/16] Clean Up --- src/Jab.Performance/Program.cs | 9 ++++++++- src/Jab.Performance/Startup/StartupBenchmark.cs | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Jab.Performance/Program.cs b/src/Jab.Performance/Program.cs index e386ad5..629abf2 100644 --- a/src/Jab.Performance/Program.cs +++ b/src/Jab.Performance/Program.cs @@ -1,4 +1,11 @@ -using System.Reflection; +using BenchmarkDotNet.Configs; using BenchmarkDotNet.Running; +using System.Reflection; BenchmarkSwitcher.FromAssembly(Assembly.GetExecutingAssembly()).Run(args); + + +//var config = ManualConfig.Create(DefaultConfig.Instance) +// .WithOptions(ConfigOptions.JoinSummary | ConfigOptions.DisableLogFile); + +//BenchmarkRunner.Run(Assembly.GetExecutingAssembly(), config); \ No newline at end of file diff --git a/src/Jab.Performance/Startup/StartupBenchmark.cs b/src/Jab.Performance/Startup/StartupBenchmark.cs index 95f7546..288be7e 100644 --- a/src/Jab.Performance/Startup/StartupBenchmark.cs +++ b/src/Jab.Performance/Startup/StartupBenchmark.cs @@ -6,7 +6,7 @@ [ShortRunJob] [Config(typeof(Config))] [GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByJob, BenchmarkLogicalGroupRule.ByCategory, BenchmarkLogicalGroupRule.ByMethod, BenchmarkLogicalGroupRule.ByParams)] -[MemoryDiagnoser]//, CategoriesColumn] +[MemoryDiagnoser] public partial class StartupBenchmark { private class Config : ManualConfig From 36a5d7a817776f85fc5ce33507bc8bed9a3e0c28 Mon Sep 17 00:00:00 2001 From: Rafael Sliveira Cordeiro Date: Mon, 15 Jan 2024 21:55:25 -0800 Subject: [PATCH 14/16] Use ShortRunJob --- .../Basic/01-Singleton/BasicSingletonBenchmark.cs | 1 + .../Basic/02-Transient/BasicTransientBenchmark.cs | 1 + src/Jab.Performance/Basic/03-Scoped/BasicScopedBenchmark.cs | 1 + src/Jab.Performance/Basic/04-Mixed/BasicMixedBenchmark.cs | 1 + src/Jab.Performance/Basic/05-Complex/BasicComplexBenchmark.cs | 1 + src/Jab.Performance/Deep/01-Singleton/DeepSingletonBenchmark.cs | 1 + src/Jab.Performance/Deep/02-Transient/DeepTransientBenchmark.cs | 1 + src/Jab.Performance/Deep/03-Scoped/DeepScopedBenchmark.cs | 1 + src/Jab.Performance/Deep/04-Mixed/DeepMixedBenchmark.cs | 1 + 9 files changed, 9 insertions(+) diff --git a/src/Jab.Performance/Basic/01-Singleton/BasicSingletonBenchmark.cs b/src/Jab.Performance/Basic/01-Singleton/BasicSingletonBenchmark.cs index 115a53c..72bb7df 100644 --- a/src/Jab.Performance/Basic/01-Singleton/BasicSingletonBenchmark.cs +++ b/src/Jab.Performance/Basic/01-Singleton/BasicSingletonBenchmark.cs @@ -5,6 +5,7 @@ using MEDI = Microsoft.Extensions.DependencyInjection; +[ShortRunJob] [MemoryDiagnoser] public class BasicSingletonBenchmark { diff --git a/src/Jab.Performance/Basic/02-Transient/BasicTransientBenchmark.cs b/src/Jab.Performance/Basic/02-Transient/BasicTransientBenchmark.cs index 9893128..9eb619e 100644 --- a/src/Jab.Performance/Basic/02-Transient/BasicTransientBenchmark.cs +++ b/src/Jab.Performance/Basic/02-Transient/BasicTransientBenchmark.cs @@ -5,6 +5,7 @@ using MEDI = Microsoft.Extensions.DependencyInjection; +[ShortRunJob] [MemoryDiagnoser] public class BasicTransientBenchmark { diff --git a/src/Jab.Performance/Basic/03-Scoped/BasicScopedBenchmark.cs b/src/Jab.Performance/Basic/03-Scoped/BasicScopedBenchmark.cs index e242709..e6c8ad3 100644 --- a/src/Jab.Performance/Basic/03-Scoped/BasicScopedBenchmark.cs +++ b/src/Jab.Performance/Basic/03-Scoped/BasicScopedBenchmark.cs @@ -5,6 +5,7 @@ using MEDI = Microsoft.Extensions.DependencyInjection; +[ShortRunJob] [MemoryDiagnoser] public class BasicScopedBenchmark { diff --git a/src/Jab.Performance/Basic/04-Mixed/BasicMixedBenchmark.cs b/src/Jab.Performance/Basic/04-Mixed/BasicMixedBenchmark.cs index 69bf545..03bd344 100644 --- a/src/Jab.Performance/Basic/04-Mixed/BasicMixedBenchmark.cs +++ b/src/Jab.Performance/Basic/04-Mixed/BasicMixedBenchmark.cs @@ -6,6 +6,7 @@ using Microsoft.Extensions.DependencyInjection; using MEDI = Microsoft.Extensions.DependencyInjection; +[ShortRunJob] [MemoryDiagnoser] public class BasicMixedBenchmark { diff --git a/src/Jab.Performance/Basic/05-Complex/BasicComplexBenchmark.cs b/src/Jab.Performance/Basic/05-Complex/BasicComplexBenchmark.cs index fa4c34e..a97f256 100644 --- a/src/Jab.Performance/Basic/05-Complex/BasicComplexBenchmark.cs +++ b/src/Jab.Performance/Basic/05-Complex/BasicComplexBenchmark.cs @@ -9,6 +9,7 @@ using MEDI = Microsoft.Extensions.DependencyInjection; +[ShortRunJob] [MemoryDiagnoser] public class BasicComplexBenchmark { diff --git a/src/Jab.Performance/Deep/01-Singleton/DeepSingletonBenchmark.cs b/src/Jab.Performance/Deep/01-Singleton/DeepSingletonBenchmark.cs index 359f52f..479995c 100644 --- a/src/Jab.Performance/Deep/01-Singleton/DeepSingletonBenchmark.cs +++ b/src/Jab.Performance/Deep/01-Singleton/DeepSingletonBenchmark.cs @@ -7,6 +7,7 @@ using MEDI = Microsoft.Extensions.DependencyInjection; +[ShortRunJob] [MemoryDiagnoser] public class DeepSingletonBenchmark { diff --git a/src/Jab.Performance/Deep/02-Transient/DeepTransientBenchmark.cs b/src/Jab.Performance/Deep/02-Transient/DeepTransientBenchmark.cs index 606d65d..6805f3f 100644 --- a/src/Jab.Performance/Deep/02-Transient/DeepTransientBenchmark.cs +++ b/src/Jab.Performance/Deep/02-Transient/DeepTransientBenchmark.cs @@ -5,6 +5,7 @@ using Microsoft.Extensions.DependencyInjection; using MEDI = Microsoft.Extensions.DependencyInjection; +[ShortRunJob] [MemoryDiagnoser] public class DeepTransientBenchmark { diff --git a/src/Jab.Performance/Deep/03-Scoped/DeepScopedBenchmark.cs b/src/Jab.Performance/Deep/03-Scoped/DeepScopedBenchmark.cs index 0a7e958..5edfdde 100644 --- a/src/Jab.Performance/Deep/03-Scoped/DeepScopedBenchmark.cs +++ b/src/Jab.Performance/Deep/03-Scoped/DeepScopedBenchmark.cs @@ -5,6 +5,7 @@ using Microsoft.Extensions.DependencyInjection; using MEDI = Microsoft.Extensions.DependencyInjection; +[ShortRunJob] [MemoryDiagnoser] public class DeepScopedBenchmark { diff --git a/src/Jab.Performance/Deep/04-Mixed/DeepMixedBenchmark.cs b/src/Jab.Performance/Deep/04-Mixed/DeepMixedBenchmark.cs index ee8d3c6..ddb4ade 100644 --- a/src/Jab.Performance/Deep/04-Mixed/DeepMixedBenchmark.cs +++ b/src/Jab.Performance/Deep/04-Mixed/DeepMixedBenchmark.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.DependencyInjection; using MEDI = Microsoft.Extensions.DependencyInjection; +[ShortRunJob] [MemoryDiagnoser] public class DeepMixedBenchmark { From a5138815835ac493bf02532aead692616d94db10 Mon Sep 17 00:00:00 2001 From: Rafael Sliveira Cordeiro Date: Mon, 15 Jan 2024 22:50:22 -0800 Subject: [PATCH 15/16] Update benchmark results --- README.md | 62 ++++++++++++------- ...lex.BasicComplexBenchmark-report-github.md | 40 ++++++++++++ ...Mixed.BasicMixedBenchmark-report-github.md | 40 ++++++++++++ ...oped.BasicScopedBenchmark-report-github.md | 40 ++++++++++++ ...n.BasicSingletonBenchmark-report-github.md | 40 ++++++++++++ ...t.BasicTransientBenchmark-report-github.md | 40 ++++++++++++ ....Mixed.DeepMixedBenchmark-report-github.md | 40 ++++++++++++ ...coped.DeepScopedBenchmark-report-github.md | 40 ++++++++++++ ...on.DeepSingletonBenchmark-report-github.md | 40 ++++++++++++ ...nt.DeepTransientBenchmark-report-github.md | 40 ++++++++++++ ....Startup.StartupBenchmark-report-github.md | 34 +++++----- 11 files changed, 415 insertions(+), 41 deletions(-) create mode 100644 doc/benchmark/Jab.Performance.Basic.Complex.BasicComplexBenchmark-report-github.md create mode 100644 doc/benchmark/Jab.Performance.Basic.Mixed.BasicMixedBenchmark-report-github.md create mode 100644 doc/benchmark/Jab.Performance.Basic.Scoped.BasicScopedBenchmark-report-github.md create mode 100644 doc/benchmark/Jab.Performance.Basic.Singleton.BasicSingletonBenchmark-report-github.md create mode 100644 doc/benchmark/Jab.Performance.Basic.Transient.BasicTransientBenchmark-report-github.md create mode 100644 doc/benchmark/Jab.Performance.Deep.Mixed.DeepMixedBenchmark-report-github.md create mode 100644 doc/benchmark/Jab.Performance.Deep.Scoped.DeepScopedBenchmark-report-github.md create mode 100644 doc/benchmark/Jab.Performance.Deep.Singleton.DeepSingletonBenchmark-report-github.md create mode 100644 doc/benchmark/Jab.Performance.Deep.Transient.DeepTransientBenchmark-report-github.md diff --git a/README.md b/README.md index 751fc21..ea64636 100644 --- a/README.md +++ b/README.md @@ -230,35 +230,49 @@ And the results in [docs/benchmark/](docs/benchmark/) The startup time benchmark measures time between application startup and the first service being resolved. -``` -| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated | Alloc Ratio | -|--------------- |-------------:|-------------:|------------:|-------:|-------:|----------:|------------:| -| Jab_Singleton | 8.629 ns | 7.745 ns | 0.4245 ns | 0.0067 | - | 56 B | 1.00 | -| MEDI_Singleton | 2,177.868 ns | 4,000.891 ns | 219.3023 ns | 0.8640 | 0.2155 | 7232 B | ? | -| | | | | | | | | -| Jab_Scoped | 7.988 ns | 6.414 ns | 0.3515 ns | 0.0038 | - | 32 B | 1.00 | -| MEDI_Scoped | 1,897.986 ns | 1,878.578 ns | 102.9712 ns | 0.8640 | 0.2155 | 7232 B | ? | -| | | | | | | | | -| Jab_Transient | 8.279 ns | 6.090 ns | 0.3338 ns | 0.0038 | - | 32 B | 1.00 | -| MEDI_Transient | 1,864.865 ns | 2,109.098 ns | 115.6068 ns | 0.8640 | 0.2155 | 7232 B | ? | -| | | | | | | | | -| Jab_Mixed | 10.311 ns | 7.034 ns | 0.3856 ns | 0.0067 | - | 56 B | 1.00 | -| MEDI_Mixed | 2,475.742 ns | 2,388.959 ns | 130.9469 ns | 1.0834 | 0.2689 | 9064 B | ? | -| | | | | | | | | -| Jab_Complex | 14.194 ns | 24.354 ns | 1.3349 ns | 0.0067 | - | 56 B | 1.00 | -| MEDI_Complex | 2,382.348 ns | 1,215.594 ns | 66.6308 ns | 1.1330 | 0.2823 | 9496 B | ? | -``` +| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated | Alloc Ratio | +|--------------- |-------------:|--------------:|------------:|-------:|-------:|----------:|------------:| +| Jab_Singleton | 8.541 ns | 3.4715 ns | 0.1903 ns | 0.0067 | - | 56 B | 1.00 | +| MEDI_Singleton | 2,162.589 ns | 2,026.5482 ns | 111.0819 ns | 0.8640 | 0.2155 | 7232 B | ? | +| | | | | | | | | +| Jab_Scoped | 9.227 ns | 4.8011 ns | 0.2632 ns | 0.0038 | - | 32 B | 1.00 | +| MEDI_Scoped | 1,895.721 ns | 2,150.1331 ns | 117.8560 ns | 0.8640 | 0.2155 | 7232 B | ? | +| | | | | | | | | +| Jab_Transient | 8.397 ns | 1.7967 ns | 0.0985 ns | 0.0038 | - | 32 B | 1.00 | +| MEDI_Transient | 2,116.654 ns | 4,289.4329 ns | 235.1183 ns | 0.8640 | 0.2155 | 7232 B | ? | +| | | | | | | | | +| Jab_Mixed | 9.697 ns | 0.1884 ns | 0.0103 ns | 0.0067 | - | 56 B | 1.00 | +| MEDI_Mixed | 2,519.538 ns | 1,988.6074 ns | 109.0023 ns | 1.0834 | 0.2689 | 9064 B | ? | +| | | | | | | | | +| Jab_Complex | 13.230 ns | 9.9845 ns | 0.5473 ns | 0.0067 | - | 56 B | 1.00 | +| MEDI_Complex | 2,429.244 ns | 1,541.6226 ns | 84.5015 ns | 1.1330 | 0.2823 | 9496 B | ? | ### GetService The `GetService` benchmark measures the `provider.GetService()` call. -``` -| Method | Mean | Error | StdDev | Ratio | RatioSD | Gen 0 | Gen 1 | Gen 2 | Allocated | -|------- |----------:|----------:|----------:|------:|--------:|-------:|------:|------:|----------:| -| MEDI | 39.340 ns | 0.2419 ns | 0.2263 ns | 7.01 | 0.09 | 0.0023 | - | - | 24 B | -| Jab | 5.619 ns | 0.0770 ns | 0.0643 ns | 1.00 | 0.00 | 0.0023 | - | - | 24 B | -``` +### Singleton + + +| Method | Mean | Error | StdDev | Ratio | RatioSD | +|-------- |-------------:|--------------:|--------------:|---------:|---------:| +| **Jab** | **3.305 ns** | **2.1067 ns** | **0.1155 ns** | **1.00** | **0.00** | +| MEDI | 9.419 ns | 6.5332 ns | 0.3581 ns | 2.85 | 0.12 | + +### Transient + +| Method | Mean | Error | StdDev | Ratio | RatioSD | +|-------- |-------------:|-------------:|-------------:|---------:|---------:| +| **Jab** | **11.33 ns** | **5.879 ns** | **0.322 ns** | **1.00** | **0.00** | +| MEDI | 14.12 ns | 3.393 ns | 0.186 ns | 1.25 | 0.02 | + +### Complex + +| Method | Mean | Error | StdDev | Ratio | RatioSD | +|-------- |-------------:|-------------:|------------:|---------:|---------:| +| **Jab** | **277.0 ns** | **62.11 ns** | **3.40 ns** | **1.00** | **0.00** | +| MEDI | 162.0 ns | 47.78 ns | 2.62 ns | 0.59 | 0.02 | + ## Debugging locally diff --git a/doc/benchmark/Jab.Performance.Basic.Complex.BasicComplexBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Basic.Complex.BasicComplexBenchmark-report-github.md new file mode 100644 index 0000000..079314e --- /dev/null +++ b/doc/benchmark/Jab.Performance.Basic.Complex.BasicComplexBenchmark-report-github.md @@ -0,0 +1,40 @@ +``` + +BenchmarkDotNet v0.13.10, Windows 10 (10.0.19045.3930/22H2/2022Update) +AMD Ryzen 9 3900XT, 1 CPU, 24 logical and 12 physical cores +.NET SDK 8.0.100 + [Host] : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + ShortRun : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + +Job=ShortRun IterationCount=3 LaunchCount=1 +WarmupCount=3 + +``` +| Method | NumbersOfCalls | NumbersOfClasses | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Gen1 | Allocated | Alloc Ratio | +|------- |--------------- |----------------- |------------:|-------------:|------------:|------:|--------:|--------:|-------:|----------:|------------:| +| **Jab** | **1** | **1** | **277.0 ns** | **62.11 ns** | **3.40 ns** | **1.00** | **0.00** | **0.0563** | **-** | **472 B** | **1.00** | +| MEDI | 1 | 1 | 162.0 ns | 47.78 ns | 2.62 ns | 0.59 | 0.02 | 0.0870 | 0.0002 | 728 B | 1.54 | +| | | | | | | | | | | | | +| **Jab** | **1** | **2** | **634.4 ns** | **54.24 ns** | **2.97 ns** | **1.00** | **0.00** | **0.1059** | **-** | **888 B** | **1.00** | +| MEDI | 1 | 2 | 299.6 ns | 215.61 ns | 11.82 ns | 0.47 | 0.02 | 0.1364 | 0.0005 | 1144 B | 1.29 | +| | | | | | | | | | | | | +| **Jab** | **1** | **3** | **806.7 ns** | **157.35 ns** | **8.63 ns** | **1.00** | **0.00** | **0.1554** | **-** | **1304 B** | **1.00** | +| MEDI | 1 | 3 | 403.2 ns | 65.49 ns | 3.59 ns | 0.50 | 0.01 | 0.1864 | 0.0010 | 1560 B | 1.20 | +| | | | | | | | | | | | | +| **Jab** | **10** | **1** | **3,121.9 ns** | **1,280.94 ns** | **70.21 ns** | **1.00** | **0.00** | **0.5608** | **-** | **4720 B** | **1.00** | +| MEDI | 10 | 1 | 1,446.4 ns | 213.28 ns | 11.69 ns | 0.46 | 0.01 | 0.8698 | 0.0019 | 7280 B | 1.54 | +| | | | | | | | | | | | | +| **Jab** | **10** | **2** | **5,938.6 ns** | **2,028.45 ns** | **111.19 ns** | **1.00** | **0.00** | **1.0605** | **-** | **8880 B** | **1.00** | +| MEDI | 10 | 2 | 2,797.2 ns | 1,919.84 ns | 105.23 ns | 0.47 | 0.02 | 1.3657 | 0.0038 | 11440 B | 1.29 | +| | | | | | | | | | | | | +| **Jab** | **10** | **3** | **8,025.6 ns** | **799.19 ns** | **43.81 ns** | **1.00** | **0.00** | **1.5564** | **-** | **13040 B** | **1.00** | +| MEDI | 10 | 3 | 4,041.0 ns | 1,878.36 ns | 102.96 ns | 0.50 | 0.01 | 1.8616 | 0.0076 | 15600 B | 1.20 | +| | | | | | | | | | | | | +| **Jab** | **100** | **1** | **29,102.0 ns** | **24,210.56 ns** | **1,327.06 ns** | **1.00** | **0.00** | **5.6152** | **-** | **47200 B** | **1.00** | +| MEDI | 100 | 1 | 14,480.0 ns | 834.85 ns | 45.76 ns | 0.50 | 0.02 | 8.6975 | 0.0153 | 72800 B | 1.54 | +| | | | | | | | | | | | | +| **Jab** | **100** | **2** | **54,089.1 ns** | **22,621.39 ns** | **1,239.95 ns** | **1.00** | **0.00** | **10.5591** | **-** | **88800 B** | **1.00** | +| MEDI | 100 | 2 | 24,947.4 ns | 3,636.34 ns | 199.32 ns | 0.46 | 0.01 | 13.6719 | 0.0305 | 114400 B | 1.29 | +| | | | | | | | | | | | | +| **Jab** | **100** | **3** | **85,991.9 ns** | **34,935.75 ns** | **1,914.95 ns** | **1.00** | **0.00** | **15.5029** | **-** | **130400 B** | **1.00** | +| MEDI | 100 | 3 | 39,692.6 ns | 2,376.76 ns | 130.28 ns | 0.46 | 0.01 | 18.6157 | 0.0610 | 156000 B | 1.20 | diff --git a/doc/benchmark/Jab.Performance.Basic.Mixed.BasicMixedBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Basic.Mixed.BasicMixedBenchmark-report-github.md new file mode 100644 index 0000000..b533a4d --- /dev/null +++ b/doc/benchmark/Jab.Performance.Basic.Mixed.BasicMixedBenchmark-report-github.md @@ -0,0 +1,40 @@ +``` + +BenchmarkDotNet v0.13.10, Windows 10 (10.0.19045.3930/22H2/2022Update) +AMD Ryzen 9 3900XT, 1 CPU, 24 logical and 12 physical cores +.NET SDK 8.0.100 + [Host] : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + ShortRun : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + +Job=ShortRun IterationCount=3 LaunchCount=1 +WarmupCount=3 + +``` +| Method | NumbersOfCalls | NumbersOfClasses | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio | +|------- |--------------- |----------------- |-------------:|-------------:|-----------:|------:|--------:|-------:|----------:|------------:| +| **Jab** | **1** | **1** | **25.80 ns** | **14.068 ns** | **0.771 ns** | **1.00** | **0.00** | **0.0105** | **88 B** | **1.00** | +| MEDI | 1 | 1 | 52.51 ns | 5.150 ns | 0.282 ns | 2.04 | 0.06 | 0.0220 | 184 B | 2.09 | +| | | | | | | | | | | | +| **Jab** | **1** | **2** | **47.85 ns** | **26.877 ns** | **1.473 ns** | **1.00** | **0.00** | **0.0172** | **144 B** | **1.00** | +| MEDI | 1 | 2 | 71.81 ns | 7.748 ns | 0.425 ns | 1.50 | 0.04 | 0.0286 | 240 B | 1.67 | +| | | | | | | | | | | | +| **Jab** | **1** | **3** | **73.12 ns** | **23.778 ns** | **1.303 ns** | **1.00** | **0.00** | **0.0238** | **200 B** | **1.00** | +| MEDI | 1 | 3 | 107.44 ns | 25.329 ns | 1.388 ns | 1.47 | 0.02 | 0.0353 | 296 B | 1.48 | +| | | | | | | | | | | | +| **Jab** | **10** | **1** | **292.33 ns** | **189.259 ns** | **10.374 ns** | **1.00** | **0.00** | **0.1049** | **880 B** | **1.00** | +| MEDI | 10 | 1 | 519.30 ns | 130.190 ns | 7.136 ns | 1.78 | 0.04 | 0.2193 | 1840 B | 2.09 | +| | | | | | | | | | | | +| **Jab** | **10** | **2** | **512.16 ns** | **357.840 ns** | **19.614 ns** | **1.00** | **0.00** | **0.1717** | **1440 B** | **1.00** | +| MEDI | 10 | 2 | 751.36 ns | 253.262 ns | 13.882 ns | 1.47 | 0.06 | 0.2861 | 2400 B | 1.67 | +| | | | | | | | | | | | +| **Jab** | **10** | **3** | **710.10 ns** | **990.641 ns** | **54.300 ns** | **1.00** | **0.00** | **0.2384** | **2000 B** | **1.00** | +| MEDI | 10 | 3 | 1,150.01 ns | 313.524 ns | 17.185 ns | 1.63 | 0.14 | 0.3529 | 2960 B | 1.48 | +| | | | | | | | | | | | +| **Jab** | **100** | **1** | **2,791.60 ns** | **1,844.990 ns** | **101.130 ns** | **1.00** | **0.00** | **1.0490** | **8800 B** | **1.00** | +| MEDI | 100 | 1 | 5,074.35 ns | 435.927 ns | 23.895 ns | 1.82 | 0.07 | 2.1973 | 18400 B | 2.09 | +| | | | | | | | | | | | +| **Jab** | **100** | **2** | **5,041.48 ns** | **3,862.300 ns** | **211.706 ns** | **1.00** | **0.00** | **1.7166** | **14400 B** | **1.00** | +| MEDI | 100 | 2 | 7,099.86 ns | 245.920 ns | 13.480 ns | 1.41 | 0.06 | 2.8687 | 24000 B | 1.67 | +| | | | | | | | | | | | +| **Jab** | **100** | **3** | **7,070.06 ns** | **606.910 ns** | **33.267 ns** | **1.00** | **0.00** | **2.3880** | **20000 B** | **1.00** | +| MEDI | 100 | 3 | 11,248.73 ns | 3,604.232 ns | 197.560 ns | 1.59 | 0.03 | 3.5248 | 29600 B | 1.48 | diff --git a/doc/benchmark/Jab.Performance.Basic.Scoped.BasicScopedBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Basic.Scoped.BasicScopedBenchmark-report-github.md new file mode 100644 index 0000000..70d476d --- /dev/null +++ b/doc/benchmark/Jab.Performance.Basic.Scoped.BasicScopedBenchmark-report-github.md @@ -0,0 +1,40 @@ +``` + +BenchmarkDotNet v0.13.10, Windows 10 (10.0.19045.3930/22H2/2022Update) +AMD Ryzen 9 3900XT, 1 CPU, 24 logical and 12 physical cores +.NET SDK 8.0.100 + [Host] : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + ShortRun : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + +Job=ShortRun IterationCount=3 LaunchCount=1 +WarmupCount=3 + +``` +| Method | NumbersOfCalls | NumbersOfClasses | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio | +|------- |--------------- |----------------- |-------------:|------------:|-----------:|------:|--------:|-------:|----------:|------------:| +| **Jab** | **1** | **1** | **26.46 ns** | **16.94 ns** | **0.929 ns** | **1.00** | **0.00** | **0.0095** | **80 B** | **1.00** | +| MEDI | 1 | 1 | 96.85 ns | 21.59 ns | 1.184 ns | 3.66 | 0.09 | 0.0401 | 336 B | 4.20 | +| | | | | | | | | | | | +| **Jab** | **1** | **2** | **38.25 ns** | **24.26 ns** | **1.330 ns** | **1.00** | **0.00** | **0.0124** | **104 B** | **1.00** | +| MEDI | 1 | 2 | 148.20 ns | 27.80 ns | 1.524 ns | 3.88 | 0.17 | 0.0429 | 360 B | 3.46 | +| | | | | | | | | | | | +| **Jab** | **1** | **3** | **46.50 ns** | **30.83 ns** | **1.690 ns** | **1.00** | **0.00** | **0.0153** | **128 B** | **1.00** | +| MEDI | 1 | 3 | 210.68 ns | 74.10 ns | 4.061 ns | 4.53 | 0.17 | 0.0458 | 384 B | 3.00 | +| | | | | | | | | | | | +| **Jab** | **10** | **1** | **252.00 ns** | **288.77 ns** | **15.828 ns** | **1.00** | **0.00** | **0.0954** | **800 B** | **1.00** | +| MEDI | 10 | 1 | 842.07 ns | 149.72 ns | 8.207 ns | 3.35 | 0.18 | 0.4015 | 3360 B | 4.20 | +| | | | | | | | | | | | +| **Jab** | **10** | **2** | **367.04 ns** | **230.07 ns** | **12.611 ns** | **1.00** | **0.00** | **0.1240** | **1040 B** | **1.00** | +| MEDI | 10 | 2 | 1,401.19 ns | 598.24 ns | 32.792 ns | 3.82 | 0.09 | 0.4292 | 3600 B | 3.46 | +| | | | | | | | | | | | +| **Jab** | **10** | **3** | **487.06 ns** | **39.30 ns** | **2.154 ns** | **1.00** | **0.00** | **0.1526** | **1280 B** | **1.00** | +| MEDI | 10 | 3 | 2,031.51 ns | 145.73 ns | 7.988 ns | 4.17 | 0.01 | 0.4578 | 3840 B | 3.00 | +| | | | | | | | | | | | +| **Jab** | **100** | **1** | **2,230.61 ns** | **2,696.16 ns** | **147.785 ns** | **1.00** | **0.00** | **0.9537** | **8000 B** | **1.00** | +| MEDI | 100 | 1 | 8,229.42 ns | 619.24 ns | 33.943 ns | 3.70 | 0.25 | 4.0131 | 33600 B | 4.20 | +| | | | | | | | | | | | +| **Jab** | **100** | **2** | **3,568.78 ns** | **2,180.27 ns** | **119.508 ns** | **1.00** | **0.00** | **1.2398** | **10400 B** | **1.00** | +| MEDI | 100 | 2 | 13,334.35 ns | 968.54 ns | 53.089 ns | 3.74 | 0.14 | 4.3030 | 36000 B | 3.46 | +| | | | | | | | | | | | +| **Jab** | **100** | **3** | **4,880.04 ns** | **2,369.98 ns** | **129.906 ns** | **1.00** | **0.00** | **1.5259** | **12800 B** | **1.00** | +| MEDI | 100 | 3 | 19,787.89 ns | 1,046.87 ns | 57.382 ns | 4.06 | 0.12 | 4.5776 | 38400 B | 3.00 | diff --git a/doc/benchmark/Jab.Performance.Basic.Singleton.BasicSingletonBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Basic.Singleton.BasicSingletonBenchmark-report-github.md new file mode 100644 index 0000000..22325a9 --- /dev/null +++ b/doc/benchmark/Jab.Performance.Basic.Singleton.BasicSingletonBenchmark-report-github.md @@ -0,0 +1,40 @@ +``` + +BenchmarkDotNet v0.13.10, Windows 10 (10.0.19045.3930/22H2/2022Update) +AMD Ryzen 9 3900XT, 1 CPU, 24 logical and 12 physical cores +.NET SDK 8.0.100 + [Host] : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + ShortRun : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + +Job=ShortRun IterationCount=3 LaunchCount=1 +WarmupCount=3 + +``` +| Method | NumbersOfCalls | NumbersOfClasses | Mean | Error | StdDev | Ratio | RatioSD | Allocated | Alloc Ratio | +|------- |--------------- |----------------- |-------------:|------------:|-----------:|------:|--------:|----------:|------------:| +| **Jab** | **1** | **1** | **3.305 ns** | **2.1067 ns** | **0.1155 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 1 | 1 | 9.419 ns | 6.5332 ns | 0.3581 ns | 2.85 | 0.12 | - | NA | +| | | | | | | | | | | +| **Jab** | **1** | **2** | **4.760 ns** | **3.2599 ns** | **0.1787 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 1 | 2 | 18.203 ns | 1.0816 ns | 0.0593 ns | 3.83 | 0.14 | - | NA | +| | | | | | | | | | | +| **Jab** | **1** | **3** | **6.606 ns** | **0.0118 ns** | **0.0006 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 1 | 3 | 32.064 ns | 0.8978 ns | 0.0492 ns | 4.85 | 0.01 | - | NA | +| | | | | | | | | | | +| **Jab** | **10** | **1** | **26.810 ns** | **0.4982 ns** | **0.0273 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 10 | 1 | 81.013 ns | 2.1421 ns | 0.1174 ns | 3.02 | 0.01 | - | NA | +| | | | | | | | | | | +| **Jab** | **10** | **2** | **46.211 ns** | **0.2974 ns** | **0.0163 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 10 | 2 | 165.596 ns | 1.0703 ns | 0.0587 ns | 3.58 | 0.00 | - | NA | +| | | | | | | | | | | +| **Jab** | **10** | **3** | **67.257 ns** | **0.8551 ns** | **0.0469 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 10 | 3 | 293.410 ns | 0.6818 ns | 0.0374 ns | 4.36 | 0.00 | - | NA | +| | | | | | | | | | | +| **Jab** | **100** | **1** | **287.397 ns** | **3.4538 ns** | **0.1893 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 100 | 1 | 769.830 ns | 36.1949 ns | 1.9840 ns | 2.68 | 0.01 | - | NA | +| | | | | | | | | | | +| **Jab** | **100** | **2** | **478.811 ns** | **231.5772 ns** | **12.6935 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 100 | 2 | 1,520.578 ns | 25.0371 ns | 1.3724 ns | 3.18 | 0.08 | - | NA | +| | | | | | | | | | | +| **Jab** | **100** | **3** | **698.762 ns** | **129.0059 ns** | **7.0712 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 100 | 3 | 3,169.651 ns | 814.2630 ns | 44.6325 ns | 4.54 | 0.09 | - | NA | diff --git a/doc/benchmark/Jab.Performance.Basic.Transient.BasicTransientBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Basic.Transient.BasicTransientBenchmark-report-github.md new file mode 100644 index 0000000..c9f721b --- /dev/null +++ b/doc/benchmark/Jab.Performance.Basic.Transient.BasicTransientBenchmark-report-github.md @@ -0,0 +1,40 @@ +``` + +BenchmarkDotNet v0.13.10, Windows 10 (10.0.19045.3930/22H2/2022Update) +AMD Ryzen 9 3900XT, 1 CPU, 24 logical and 12 physical cores +.NET SDK 8.0.100 + [Host] : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + ShortRun : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + +Job=ShortRun IterationCount=3 LaunchCount=1 +WarmupCount=3 + +``` +| Method | NumbersOfCalls | NumbersOfClasses | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio | +|------- |--------------- |----------------- |------------:|-------------:|-----------:|------:|--------:|-------:|----------:|------------:| +| **Jab** | **1** | **1** | **11.33 ns** | **5.879 ns** | **0.322 ns** | **1.00** | **0.00** | **0.0029** | **24 B** | **1.00** | +| MEDI | 1 | 1 | 14.12 ns | 3.393 ns | 0.186 ns | 1.25 | 0.02 | 0.0029 | 24 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **1** | **2** | **20.91 ns** | **4.753 ns** | **0.261 ns** | **1.00** | **0.00** | **0.0057** | **48 B** | **1.00** | +| MEDI | 1 | 2 | 26.62 ns | 7.297 ns | 0.400 ns | 1.27 | 0.02 | 0.0057 | 48 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **1** | **3** | **28.92 ns** | **0.939 ns** | **0.051 ns** | **1.00** | **0.00** | **0.0086** | **72 B** | **1.00** | +| MEDI | 1 | 3 | 38.40 ns | 46.302 ns | 2.538 ns | 1.33 | 0.09 | 0.0086 | 72 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **10** | **1** | **112.80 ns** | **36.870 ns** | **2.021 ns** | **1.00** | **0.00** | **0.0286** | **240 B** | **1.00** | +| MEDI | 10 | 1 | 134.00 ns | 57.506 ns | 3.152 ns | 1.19 | 0.02 | 0.0286 | 240 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **10** | **2** | **210.40 ns** | **65.697 ns** | **3.601 ns** | **1.00** | **0.00** | **0.0572** | **480 B** | **1.00** | +| MEDI | 10 | 2 | 256.86 ns | 122.244 ns | 6.701 ns | 1.22 | 0.02 | 0.0572 | 480 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **10** | **3** | **307.42 ns** | **107.202 ns** | **5.876 ns** | **1.00** | **0.00** | **0.0858** | **720 B** | **1.00** | +| MEDI | 10 | 3 | 405.50 ns | 210.375 ns | 11.531 ns | 1.32 | 0.03 | 0.0858 | 720 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **100** | **1** | **1,014.30 ns** | **67.634 ns** | **3.707 ns** | **1.00** | **0.00** | **0.2861** | **2400 B** | **1.00** | +| MEDI | 100 | 1 | 1,198.04 ns | 1,693.470 ns | 92.825 ns | 1.18 | 0.09 | 0.2861 | 2400 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **100** | **2** | **1,967.15 ns** | **153.610 ns** | **8.420 ns** | **1.00** | **0.00** | **0.5722** | **4800 B** | **1.00** | +| MEDI | 100 | 2 | 2,430.37 ns | 427.372 ns | 23.426 ns | 1.24 | 0.01 | 0.5722 | 4800 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **100** | **3** | **3,018.39 ns** | **1,815.571 ns** | **99.518 ns** | **1.00** | **0.00** | **0.8583** | **7200 B** | **1.00** | +| MEDI | 100 | 3 | 3,681.80 ns | 4,709.551 ns | 258.146 ns | 1.22 | 0.11 | 0.8583 | 7200 B | 1.00 | diff --git a/doc/benchmark/Jab.Performance.Deep.Mixed.DeepMixedBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Deep.Mixed.DeepMixedBenchmark-report-github.md new file mode 100644 index 0000000..e3a5e79 --- /dev/null +++ b/doc/benchmark/Jab.Performance.Deep.Mixed.DeepMixedBenchmark-report-github.md @@ -0,0 +1,40 @@ +``` + +BenchmarkDotNet v0.13.10, Windows 10 (10.0.19045.3930/22H2/2022Update) +AMD Ryzen 9 3900XT, 1 CPU, 24 logical and 12 physical cores +.NET SDK 8.0.100 + [Host] : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + ShortRun : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + +Job=ShortRun IterationCount=3 LaunchCount=1 +WarmupCount=3 + +``` +| Method | NumbersOfCalls | Deep | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio | +|------- |--------------- |----- |------------:|-------------:|-----------:|------:|--------:|-------:|----------:|------------:| +| **Jab** | **1** | **1** | **26.94 ns** | **11.260 ns** | **0.617 ns** | **1.00** | **0.00** | **0.0105** | **88 B** | **1.00** | +| MEDI | 1 | 1 | 57.11 ns | 47.088 ns | 2.581 ns | 2.12 | 0.14 | 0.0219 | 184 B | 2.09 | +| | | | | | | | | | | | +| **Jab** | **1** | **10** | **25.78 ns** | **0.474 ns** | **0.026 ns** | **1.00** | **0.00** | **0.0105** | **88 B** | **1.00** | +| MEDI | 1 | 10 | 53.43 ns | 21.806 ns | 1.195 ns | 2.07 | 0.05 | 0.0219 | 184 B | 2.09 | +| | | | | | | | | | | | +| **Jab** | **1** | **100** | **26.80 ns** | **26.672 ns** | **1.462 ns** | **1.00** | **0.00** | **0.0105** | **88 B** | **1.00** | +| MEDI | 1 | 100 | 58.44 ns | 71.548 ns | 3.922 ns | 2.18 | 0.14 | 0.0219 | 184 B | 2.09 | +| | | | | | | | | | | | +| **Jab** | **10** | **1** | **281.17 ns** | **478.602 ns** | **26.234 ns** | **1.00** | **0.00** | **0.1049** | **880 B** | **1.00** | +| MEDI | 10 | 1 | 542.59 ns | 322.762 ns | 17.692 ns | 1.94 | 0.12 | 0.2193 | 1840 B | 2.09 | +| | | | | | | | | | | | +| **Jab** | **10** | **10** | **278.47 ns** | **157.738 ns** | **8.646 ns** | **1.00** | **0.00** | **0.1049** | **880 B** | **1.00** | +| MEDI | 10 | 10 | 540.72 ns | 439.471 ns | 24.089 ns | 1.94 | 0.13 | 0.2193 | 1840 B | 2.09 | +| | | | | | | | | | | | +| **Jab** | **10** | **100** | **307.36 ns** | **173.688 ns** | **9.520 ns** | **1.00** | **0.00** | **0.1049** | **880 B** | **1.00** | +| MEDI | 10 | 100 | 543.88 ns | 274.627 ns | 15.053 ns | 1.77 | 0.06 | 0.2193 | 1840 B | 2.09 | +| | | | | | | | | | | | +| **Jab** | **100** | **1** | **2,587.16 ns** | **3,486.341 ns** | **191.098 ns** | **1.00** | **0.00** | **1.0490** | **8800 B** | **1.00** | +| MEDI | 100 | 1 | 5,222.47 ns | 1,059.804 ns | 58.091 ns | 2.03 | 0.15 | 2.1973 | 18400 B | 2.09 | +| | | | | | | | | | | | +| **Jab** | **100** | **10** | **2,942.41 ns** | **1,713.042 ns** | **93.898 ns** | **1.00** | **0.00** | **1.0490** | **8800 B** | **1.00** | +| MEDI | 100 | 10 | 5,672.47 ns | 328.126 ns | 17.986 ns | 1.93 | 0.07 | 2.1973 | 18400 B | 2.09 | +| | | | | | | | | | | | +| **Jab** | **100** | **100** | **2,972.94 ns** | **1,335.825 ns** | **73.221 ns** | **1.00** | **0.00** | **1.0490** | **8800 B** | **1.00** | +| MEDI | 100 | 100 | 5,038.35 ns | 502.338 ns | 27.535 ns | 1.70 | 0.05 | 2.1973 | 18400 B | 2.09 | diff --git a/doc/benchmark/Jab.Performance.Deep.Scoped.DeepScopedBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Deep.Scoped.DeepScopedBenchmark-report-github.md new file mode 100644 index 0000000..676a00d --- /dev/null +++ b/doc/benchmark/Jab.Performance.Deep.Scoped.DeepScopedBenchmark-report-github.md @@ -0,0 +1,40 @@ +``` + +BenchmarkDotNet v0.13.10, Windows 10 (10.0.19045.3930/22H2/2022Update) +AMD Ryzen 9 3900XT, 1 CPU, 24 logical and 12 physical cores +.NET SDK 8.0.100 + [Host] : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + ShortRun : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + +Job=ShortRun IterationCount=3 LaunchCount=1 +WarmupCount=3 + +``` +| Method | NumbersOfCalls | Deep | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Gen1 | Allocated | Alloc Ratio | +|------- |--------------- |----- |-------------:|-------------:|-------------:|------:|--------:|--------:|-------:|----------:|------------:| +| **Jab** | **1** | **1** | **212.63 ns** | **156.92 ns** | **8.602 ns** | **1.00** | **0.00** | **0.1023** | **0.0002** | **856 B** | **1.00** | +| MEDI | 1 | 1 | 97.70 ns | 73.44 ns | 4.026 ns | 0.46 | 0.01 | 0.0401 | - | 336 B | 0.39 | +| | | | | | | | | | | | | +| **Jab** | **1** | **10** | **209.61 ns** | **77.34 ns** | **4.239 ns** | **1.00** | **0.00** | **0.1023** | **0.0002** | **856 B** | **1.00** | +| MEDI | 1 | 10 | 87.64 ns | 52.89 ns | 2.899 ns | 0.42 | 0.02 | 0.0401 | - | 336 B | 0.39 | +| | | | | | | | | | | | | +| **Jab** | **1** | **100** | **206.04 ns** | **72.77 ns** | **3.989 ns** | **1.00** | **0.00** | **0.1023** | **0.0002** | **856 B** | **1.00** | +| MEDI | 1 | 100 | 92.20 ns | 72.93 ns | 3.997 ns | 0.45 | 0.02 | 0.0401 | - | 336 B | 0.39 | +| | | | | | | | | | | | | +| **Jab** | **10** | **1** | **1,961.15 ns** | **159.24 ns** | **8.729 ns** | **1.00** | **0.00** | **1.0223** | **-** | **8560 B** | **1.00** | +| MEDI | 10 | 1 | 907.53 ns | 482.66 ns | 26.456 ns | 0.46 | 0.02 | 0.4015 | - | 3360 B | 0.39 | +| | | | | | | | | | | | | +| **Jab** | **10** | **10** | **2,144.65 ns** | **119.12 ns** | **6.529 ns** | **1.00** | **0.00** | **1.0223** | **-** | **8560 B** | **1.00** | +| MEDI | 10 | 10 | 949.59 ns | 369.82 ns | 20.271 ns | 0.44 | 0.01 | 0.4015 | - | 3360 B | 0.39 | +| | | | | | | | | | | | | +| **Jab** | **10** | **100** | **1,931.06 ns** | **243.37 ns** | **13.340 ns** | **1.00** | **0.00** | **1.0223** | **-** | **8560 B** | **1.00** | +| MEDI | 10 | 100 | 1,019.13 ns | 778.85 ns | 42.692 ns | 0.53 | 0.03 | 0.4005 | - | 3360 B | 0.39 | +| | | | | | | | | | | | | +| **Jab** | **100** | **1** | **19,513.04 ns** | **7,023.74 ns** | **384.995 ns** | **1.00** | **0.00** | **10.2234** | **0.0305** | **85600 B** | **1.00** | +| MEDI | 100 | 1 | 8,973.90 ns | 3,427.00 ns | 187.845 ns | 0.46 | 0.01 | 4.0131 | - | 33600 B | 0.39 | +| | | | | | | | | | | | | +| **Jab** | **100** | **10** | **22,074.98 ns** | **1,970.06 ns** | **107.986 ns** | **1.00** | **0.00** | **10.2234** | **0.0305** | **85600 B** | **1.00** | +| MEDI | 100 | 10 | 8,702.05 ns | 3,420.80 ns | 187.506 ns | 0.39 | 0.01 | 4.0131 | - | 33600 B | 0.39 | +| | | | | | | | | | | | | +| **Jab** | **100** | **100** | **20,437.55 ns** | **22,317.04 ns** | **1,223.272 ns** | **1.00** | **0.00** | **10.2234** | **0.0305** | **85600 B** | **1.00** | +| MEDI | 100 | 100 | 8,516.09 ns | 1,294.09 ns | 70.934 ns | 0.42 | 0.03 | 4.0131 | - | 33600 B | 0.39 | diff --git a/doc/benchmark/Jab.Performance.Deep.Singleton.DeepSingletonBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Deep.Singleton.DeepSingletonBenchmark-report-github.md new file mode 100644 index 0000000..a4253d2 --- /dev/null +++ b/doc/benchmark/Jab.Performance.Deep.Singleton.DeepSingletonBenchmark-report-github.md @@ -0,0 +1,40 @@ +``` + +BenchmarkDotNet v0.13.10, Windows 10 (10.0.19045.3930/22H2/2022Update) +AMD Ryzen 9 3900XT, 1 CPU, 24 logical and 12 physical cores +.NET SDK 8.0.100 + [Host] : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + ShortRun : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + +Job=ShortRun IterationCount=3 LaunchCount=1 +WarmupCount=3 + +``` +| Method | NumbersOfCalls | Deep | Mean | Error | StdDev | Ratio | RatioSD | Allocated | Alloc Ratio | +|------- |--------------- |----- |-----------:|------------:|-----------:|------:|--------:|----------:|------------:| +| **Jab** | **1** | **1** | **3.297 ns** | **1.8021 ns** | **0.0988 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 1 | 1 | 9.320 ns | 0.9370 ns | 0.0514 ns | 2.83 | 0.09 | - | NA | +| | | | | | | | | | | +| **Jab** | **1** | **10** | **3.158 ns** | **0.2176 ns** | **0.0119 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 1 | 10 | 9.526 ns | 1.1012 ns | 0.0604 ns | 3.02 | 0.01 | - | NA | +| | | | | | | | | | | +| **Jab** | **1** | **100** | **3.004 ns** | **0.1847 ns** | **0.0101 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 1 | 100 | 9.722 ns | 0.9311 ns | 0.0510 ns | 3.24 | 0.01 | - | NA | +| | | | | | | | | | | +| **Jab** | **10** | **1** | **27.939 ns** | **1.0508 ns** | **0.0576 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 10 | 1 | 82.556 ns | 40.5199 ns | 2.2210 ns | 2.95 | 0.08 | - | NA | +| | | | | | | | | | | +| **Jab** | **10** | **10** | **29.781 ns** | **0.5570 ns** | **0.0305 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 10 | 10 | 78.532 ns | 21.6593 ns | 1.1872 ns | 2.64 | 0.04 | - | NA | +| | | | | | | | | | | +| **Jab** | **10** | **100** | **29.616 ns** | **0.3370 ns** | **0.0185 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 10 | 100 | 81.977 ns | 15.6892 ns | 0.8600 ns | 2.77 | 0.03 | - | NA | +| | | | | | | | | | | +| **Jab** | **100** | **1** | **275.846 ns** | **2.6353 ns** | **0.1445 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 100 | 1 | 786.527 ns | 303.4739 ns | 16.6344 ns | 2.85 | 0.06 | - | NA | +| | | | | | | | | | | +| **Jab** | **100** | **10** | **306.175 ns** | **5.7135 ns** | **0.3132 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 100 | 10 | 772.480 ns | 80.7704 ns | 4.4273 ns | 2.52 | 0.01 | - | NA | +| | | | | | | | | | | +| **Jab** | **100** | **100** | **301.953 ns** | **2.8402 ns** | **0.1557 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 100 | 100 | 791.760 ns | 318.5198 ns | 17.4591 ns | 2.62 | 0.06 | - | NA | diff --git a/doc/benchmark/Jab.Performance.Deep.Transient.DeepTransientBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Deep.Transient.DeepTransientBenchmark-report-github.md new file mode 100644 index 0000000..0f117ab --- /dev/null +++ b/doc/benchmark/Jab.Performance.Deep.Transient.DeepTransientBenchmark-report-github.md @@ -0,0 +1,40 @@ +``` + +BenchmarkDotNet v0.13.10, Windows 10 (10.0.19045.3930/22H2/2022Update) +AMD Ryzen 9 3900XT, 1 CPU, 24 logical and 12 physical cores +.NET SDK 8.0.100 + [Host] : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + ShortRun : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + +Job=ShortRun IterationCount=3 LaunchCount=1 +WarmupCount=3 + +``` +| Method | NumbersOfCalls | Deep | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio | +|------- |--------------- |----- |------------:|-----------:|----------:|------:|--------:|-------:|----------:|------------:| +| **Jab** | **1** | **1** | **11.38 ns** | **2.843 ns** | **0.156 ns** | **1.00** | **0.00** | **0.0029** | **24 B** | **1.00** | +| MEDI | 1 | 1 | 15.48 ns | 1.107 ns | 0.061 ns | 1.36 | 0.02 | 0.0029 | 24 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **1** | **10** | **11.58 ns** | **4.950 ns** | **0.271 ns** | **1.00** | **0.00** | **0.0029** | **24 B** | **1.00** | +| MEDI | 1 | 10 | 14.52 ns | 7.889 ns | 0.432 ns | 1.25 | 0.03 | 0.0029 | 24 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **1** | **100** | **11.93 ns** | **6.984 ns** | **0.383 ns** | **1.00** | **0.00** | **0.0029** | **24 B** | **1.00** | +| MEDI | 1 | 100 | 14.17 ns | 1.164 ns | 0.064 ns | 1.19 | 0.03 | 0.0029 | 24 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **10** | **1** | **119.07 ns** | **57.469 ns** | **3.150 ns** | **1.00** | **0.00** | **0.0286** | **240 B** | **1.00** | +| MEDI | 10 | 1 | 114.72 ns | 14.546 ns | 0.797 ns | 0.96 | 0.03 | 0.0286 | 240 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **10** | **10** | **123.94 ns** | **29.047 ns** | **1.592 ns** | **1.00** | **0.00** | **0.0286** | **240 B** | **1.00** | +| MEDI | 10 | 10 | 116.57 ns | 41.713 ns | 2.286 ns | 0.94 | 0.02 | 0.0286 | 240 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **10** | **100** | **116.56 ns** | **96.826 ns** | **5.307 ns** | **1.00** | **0.00** | **0.0286** | **240 B** | **1.00** | +| MEDI | 10 | 100 | 115.82 ns | 37.100 ns | 2.034 ns | 1.00 | 0.06 | 0.0286 | 240 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **100** | **1** | **1,037.03 ns** | **117.815 ns** | **6.458 ns** | **1.00** | **0.00** | **0.2861** | **2400 B** | **1.00** | +| MEDI | 100 | 1 | 1,098.06 ns | 109.267 ns | 5.989 ns | 1.06 | 0.01 | 0.2861 | 2400 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **100** | **10** | **1,139.52 ns** | **280.886 ns** | **15.396 ns** | **1.00** | **0.00** | **0.2861** | **2400 B** | **1.00** | +| MEDI | 100 | 10 | 1,152.13 ns | 321.683 ns | 17.633 ns | 1.01 | 0.02 | 0.2861 | 2400 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **100** | **100** | **1,190.60 ns** | **103.101 ns** | **5.651 ns** | **1.00** | **0.00** | **0.2861** | **2400 B** | **1.00** | +| MEDI | 100 | 100 | 1,141.38 ns | 229.728 ns | 12.592 ns | 0.96 | 0.02 | 0.2861 | 2400 B | 1.00 | diff --git a/doc/benchmark/Jab.Performance.Startup.StartupBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Startup.StartupBenchmark-report-github.md index 7626ecd..86c6055 100644 --- a/doc/benchmark/Jab.Performance.Startup.StartupBenchmark-report-github.md +++ b/doc/benchmark/Jab.Performance.Startup.StartupBenchmark-report-github.md @@ -1,6 +1,6 @@ ``` -BenchmarkDotNet v0.13.10, Windows 10 (10.0.19045.3803/22H2/2022Update) +BenchmarkDotNet v0.13.10, Windows 10 (10.0.19045.3930/22H2/2022Update) AMD Ryzen 9 3900XT, 1 CPU, 24 logical and 12 physical cores .NET SDK 8.0.100 [Host] : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 @@ -10,19 +10,19 @@ Job=ShortRun IterationCount=3 LaunchCount=1 WarmupCount=3 ``` -| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated | Alloc Ratio | -|--------------- |-------------:|-------------:|------------:|-------:|-------:|----------:|------------:| -| Jab_Singleton | 8.629 ns | 7.745 ns | 0.4245 ns | 0.0067 | - | 56 B | 1.00 | -| MEDI_Singleton | 2,177.868 ns | 4,000.891 ns | 219.3023 ns | 0.8640 | 0.2155 | 7232 B | ? | -| | | | | | | | | -| Jab_Scoped | 7.988 ns | 6.414 ns | 0.3515 ns | 0.0038 | - | 32 B | 1.00 | -| MEDI_Scoped | 1,897.986 ns | 1,878.578 ns | 102.9712 ns | 0.8640 | 0.2155 | 7232 B | ? | -| | | | | | | | | -| Jab_Transient | 8.279 ns | 6.090 ns | 0.3338 ns | 0.0038 | - | 32 B | 1.00 | -| MEDI_Transient | 1,864.865 ns | 2,109.098 ns | 115.6068 ns | 0.8640 | 0.2155 | 7232 B | ? | -| | | | | | | | | -| Jab_Mixed | 10.311 ns | 7.034 ns | 0.3856 ns | 0.0067 | - | 56 B | 1.00 | -| MEDI_Mixed | 2,475.742 ns | 2,388.959 ns | 130.9469 ns | 1.0834 | 0.2689 | 9064 B | ? | -| | | | | | | | | -| Jab_Complex | 14.194 ns | 24.354 ns | 1.3349 ns | 0.0067 | - | 56 B | 1.00 | -| MEDI_Complex | 2,382.348 ns | 1,215.594 ns | 66.6308 ns | 1.1330 | 0.2823 | 9496 B | ? | +| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated | Alloc Ratio | +|--------------- |-------------:|--------------:|------------:|-------:|-------:|----------:|------------:| +| Jab_Singleton | 8.541 ns | 3.4715 ns | 0.1903 ns | 0.0067 | - | 56 B | 1.00 | +| MEDI_Singleton | 2,162.589 ns | 2,026.5482 ns | 111.0819 ns | 0.8640 | 0.2155 | 7232 B | ? | +| | | | | | | | | +| Jab_Scoped | 9.227 ns | 4.8011 ns | 0.2632 ns | 0.0038 | - | 32 B | 1.00 | +| MEDI_Scoped | 1,895.721 ns | 2,150.1331 ns | 117.8560 ns | 0.8640 | 0.2155 | 7232 B | ? | +| | | | | | | | | +| Jab_Transient | 8.397 ns | 1.7967 ns | 0.0985 ns | 0.0038 | - | 32 B | 1.00 | +| MEDI_Transient | 2,116.654 ns | 4,289.4329 ns | 235.1183 ns | 0.8640 | 0.2155 | 7232 B | ? | +| | | | | | | | | +| Jab_Mixed | 9.697 ns | 0.1884 ns | 0.0103 ns | 0.0067 | - | 56 B | 1.00 | +| MEDI_Mixed | 2,519.538 ns | 1,988.6074 ns | 109.0023 ns | 1.0834 | 0.2689 | 9064 B | ? | +| | | | | | | | | +| Jab_Complex | 13.230 ns | 9.9845 ns | 0.5473 ns | 0.0067 | - | 56 B | 1.00 | +| MEDI_Complex | 2,429.244 ns | 1,541.6226 ns | 84.5015 ns | 1.1330 | 0.2823 | 9496 B | ? | From f6e4281bfc540e45d5dbfa6a8faf2050ca59a8f7 Mon Sep 17 00:00:00 2001 From: Rafael Sliveira Cordeiro Date: Mon, 15 Jan 2024 23:22:57 -0800 Subject: [PATCH 16/16] Update Results --- README.md | 51 ++++++++--------- ...lex.BasicComplexBenchmark-report-github.md | 56 +++++++++---------- ...Mixed.BasicMixedBenchmark-report-github.md | 36 ++++++------ ...oped.BasicScopedBenchmark-report-github.md | 36 ++++++------ ...n.BasicSingletonBenchmark-report-github.md | 56 +++++++++---------- ...t.BasicTransientBenchmark-report-github.md | 56 +++++++++---------- ....Mixed.DeepMixedBenchmark-report-github.md | 36 ++++++------ ...coped.DeepScopedBenchmark-report-github.md | 56 +++++++++---------- ...on.DeepSingletonBenchmark-report-github.md | 56 +++++++++---------- ...nt.DeepTransientBenchmark-report-github.md | 36 ++++++------ ....Startup.StartupBenchmark-report-github.md | 20 +++---- 11 files changed, 248 insertions(+), 247 deletions(-) diff --git a/README.md b/README.md index aa30441..16f971b 100644 --- a/README.md +++ b/README.md @@ -254,22 +254,22 @@ And the results in [docs/benchmark/](docs/benchmark/) The startup time benchmark measures time between application startup and the first service being resolved. -| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated | Alloc Ratio | -|--------------- |-------------:|--------------:|------------:|-------:|-------:|----------:|------------:| -| Jab_Singleton | 8.541 ns | 3.4715 ns | 0.1903 ns | 0.0067 | - | 56 B | 1.00 | -| MEDI_Singleton | 2,162.589 ns | 2,026.5482 ns | 111.0819 ns | 0.8640 | 0.2155 | 7232 B | ? | -| | | | | | | | | -| Jab_Scoped | 9.227 ns | 4.8011 ns | 0.2632 ns | 0.0038 | - | 32 B | 1.00 | -| MEDI_Scoped | 1,895.721 ns | 2,150.1331 ns | 117.8560 ns | 0.8640 | 0.2155 | 7232 B | ? | -| | | | | | | | | -| Jab_Transient | 8.397 ns | 1.7967 ns | 0.0985 ns | 0.0038 | - | 32 B | 1.00 | -| MEDI_Transient | 2,116.654 ns | 4,289.4329 ns | 235.1183 ns | 0.8640 | 0.2155 | 7232 B | ? | -| | | | | | | | | -| Jab_Mixed | 9.697 ns | 0.1884 ns | 0.0103 ns | 0.0067 | - | 56 B | 1.00 | -| MEDI_Mixed | 2,519.538 ns | 1,988.6074 ns | 109.0023 ns | 1.0834 | 0.2689 | 9064 B | ? | -| | | | | | | | | -| Jab_Complex | 13.230 ns | 9.9845 ns | 0.5473 ns | 0.0067 | - | 56 B | 1.00 | -| MEDI_Complex | 2,429.244 ns | 1,541.6226 ns | 84.5015 ns | 1.1330 | 0.2823 | 9496 B | ? | +| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated | +|--------------- |-------------:|--------------:|------------:|-------:|-------:|----------:| +| Jab_Singleton | 8.763 ns | 0.5496 ns | 0.0301 ns | 0.0067 | - | 56 B | +| MEDI_Singleton | 1,883.539 ns | 1,976.8621 ns | 108.3585 ns | 0.8640 | 0.2155 | 7232 B | +| | | | | | | | +| Jab_Scoped | 8.445 ns | 6.0425 ns | 0.3312 ns | 0.0038 | - | 32 B | +| MEDI_Scoped | 1,894.341 ns | 1,854.7252 ns | 101.6637 ns | 0.8640 | 0.2155 | 7232 B | +| | | | | | | | +| Jab_Transient | 8.695 ns | 11.2536 ns | 0.6168 ns | 0.0038 | - | 32 B | +| MEDI_Transient | 1,894.840 ns | 2,000.5040 ns | 109.6544 ns | 0.8640 | 0.2155 | 7232 B | +| | | | | | | | +| Jab_Mixed | 9.722 ns | 2.2865 ns | 0.1253 ns | 0.0067 | - | 56 B | +| MEDI_Mixed | 2,454.882 ns | 2,626.4526 ns | 143.9647 ns | 1.0834 | 0.2689 | 9064 B | +| | | | | | | | +| Jab_Complex | 13.402 ns | 4.5401 ns | 0.2489 ns | 0.0067 | - | 56 B | +| MEDI_Complex | 2,350.227 ns | 2,335.5694 ns | 128.0204 ns | 1.1330 | 0.2823 | 9496 B | ### GetService @@ -277,25 +277,26 @@ The `GetService` benchmark measures the `provider.GetService()` call. ### Singleton - | Method | Mean | Error | StdDev | Ratio | RatioSD | |-------- |-------------:|--------------:|--------------:|---------:|---------:| -| **Jab** | **3.305 ns** | **2.1067 ns** | **0.1155 ns** | **1.00** | **0.00** | -| MEDI | 9.419 ns | 6.5332 ns | 0.3581 ns | 2.85 | 0.12 | +| **Jab** | **3.325 ns** | **2.1053 ns** | **0.1154 ns** | **1.00** | **0.00** | +| MEDI | 9.241 ns | 0.2836 ns | 0.0155 ns | 2.78 | 0.09 | ### Transient | Method | Mean | Error | StdDev | Ratio | RatioSD | |-------- |-------------:|-------------:|-------------:|---------:|---------:| -| **Jab** | **11.33 ns** | **5.879 ns** | **0.322 ns** | **1.00** | **0.00** | -| MEDI | 14.12 ns | 3.393 ns | 0.186 ns | 1.25 | 0.02 | +| **Jab** | **11.29 ns** | **3.599 ns** | **0.197 ns** | **1.00** | **0.00** | +| MEDI | 13.46 ns | 1.805 ns | 0.099 ns | 1.19 | 0.03 | + ### Complex -| Method | Mean | Error | StdDev | Ratio | RatioSD | -|-------- |-------------:|-------------:|------------:|---------:|---------:| -| **Jab** | **277.0 ns** | **62.11 ns** | **3.40 ns** | **1.00** | **0.00** | -| MEDI | 162.0 ns | 47.78 ns | 2.62 ns | 0.59 | 0.02 | +| Method | Mean | Error | StdDev | Ratio | RatioSD | +|-------- |-------------:|--------------:|------------:|----------:|---------:| +| **Jab** | **279.6 ns** | **154.26 ns** | **8.46 ns** | **1.00** | **0.00** | +| MEDI | 149.2 ns | 20.02 ns | 1.10 ns | 0.53 | 0.02 | + ## Unity installation diff --git a/doc/benchmark/Jab.Performance.Basic.Complex.BasicComplexBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Basic.Complex.BasicComplexBenchmark-report-github.md index 079314e..0129bc7 100644 --- a/doc/benchmark/Jab.Performance.Basic.Complex.BasicComplexBenchmark-report-github.md +++ b/doc/benchmark/Jab.Performance.Basic.Complex.BasicComplexBenchmark-report-github.md @@ -10,31 +10,31 @@ Job=ShortRun IterationCount=3 LaunchCount=1 WarmupCount=3 ``` -| Method | NumbersOfCalls | NumbersOfClasses | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Gen1 | Allocated | Alloc Ratio | -|------- |--------------- |----------------- |------------:|-------------:|------------:|------:|--------:|--------:|-------:|----------:|------------:| -| **Jab** | **1** | **1** | **277.0 ns** | **62.11 ns** | **3.40 ns** | **1.00** | **0.00** | **0.0563** | **-** | **472 B** | **1.00** | -| MEDI | 1 | 1 | 162.0 ns | 47.78 ns | 2.62 ns | 0.59 | 0.02 | 0.0870 | 0.0002 | 728 B | 1.54 | -| | | | | | | | | | | | | -| **Jab** | **1** | **2** | **634.4 ns** | **54.24 ns** | **2.97 ns** | **1.00** | **0.00** | **0.1059** | **-** | **888 B** | **1.00** | -| MEDI | 1 | 2 | 299.6 ns | 215.61 ns | 11.82 ns | 0.47 | 0.02 | 0.1364 | 0.0005 | 1144 B | 1.29 | -| | | | | | | | | | | | | -| **Jab** | **1** | **3** | **806.7 ns** | **157.35 ns** | **8.63 ns** | **1.00** | **0.00** | **0.1554** | **-** | **1304 B** | **1.00** | -| MEDI | 1 | 3 | 403.2 ns | 65.49 ns | 3.59 ns | 0.50 | 0.01 | 0.1864 | 0.0010 | 1560 B | 1.20 | -| | | | | | | | | | | | | -| **Jab** | **10** | **1** | **3,121.9 ns** | **1,280.94 ns** | **70.21 ns** | **1.00** | **0.00** | **0.5608** | **-** | **4720 B** | **1.00** | -| MEDI | 10 | 1 | 1,446.4 ns | 213.28 ns | 11.69 ns | 0.46 | 0.01 | 0.8698 | 0.0019 | 7280 B | 1.54 | -| | | | | | | | | | | | | -| **Jab** | **10** | **2** | **5,938.6 ns** | **2,028.45 ns** | **111.19 ns** | **1.00** | **0.00** | **1.0605** | **-** | **8880 B** | **1.00** | -| MEDI | 10 | 2 | 2,797.2 ns | 1,919.84 ns | 105.23 ns | 0.47 | 0.02 | 1.3657 | 0.0038 | 11440 B | 1.29 | -| | | | | | | | | | | | | -| **Jab** | **10** | **3** | **8,025.6 ns** | **799.19 ns** | **43.81 ns** | **1.00** | **0.00** | **1.5564** | **-** | **13040 B** | **1.00** | -| MEDI | 10 | 3 | 4,041.0 ns | 1,878.36 ns | 102.96 ns | 0.50 | 0.01 | 1.8616 | 0.0076 | 15600 B | 1.20 | -| | | | | | | | | | | | | -| **Jab** | **100** | **1** | **29,102.0 ns** | **24,210.56 ns** | **1,327.06 ns** | **1.00** | **0.00** | **5.6152** | **-** | **47200 B** | **1.00** | -| MEDI | 100 | 1 | 14,480.0 ns | 834.85 ns | 45.76 ns | 0.50 | 0.02 | 8.6975 | 0.0153 | 72800 B | 1.54 | -| | | | | | | | | | | | | -| **Jab** | **100** | **2** | **54,089.1 ns** | **22,621.39 ns** | **1,239.95 ns** | **1.00** | **0.00** | **10.5591** | **-** | **88800 B** | **1.00** | -| MEDI | 100 | 2 | 24,947.4 ns | 3,636.34 ns | 199.32 ns | 0.46 | 0.01 | 13.6719 | 0.0305 | 114400 B | 1.29 | -| | | | | | | | | | | | | -| **Jab** | **100** | **3** | **85,991.9 ns** | **34,935.75 ns** | **1,914.95 ns** | **1.00** | **0.00** | **15.5029** | **-** | **130400 B** | **1.00** | -| MEDI | 100 | 3 | 39,692.6 ns | 2,376.76 ns | 130.28 ns | 0.46 | 0.01 | 18.6157 | 0.0610 | 156000 B | 1.20 | +| Method | NumbersOfCalls | NumbersOfClasses | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Gen1 | Allocated | Alloc Ratio | +|------- |--------------- |----------------- |------------:|--------------:|------------:|------:|--------:|--------:|-------:|----------:|------------:| +| **Jab** | **1** | **1** | **279.6 ns** | **154.26 ns** | **8.46 ns** | **1.00** | **0.00** | **0.0563** | **-** | **472 B** | **1.00** | +| MEDI | 1 | 1 | 149.2 ns | 20.02 ns | 1.10 ns | 0.53 | 0.02 | 0.0870 | 0.0002 | 728 B | 1.54 | +| | | | | | | | | | | | | +| **Jab** | **1** | **2** | **565.4 ns** | **80.38 ns** | **4.41 ns** | **1.00** | **0.00** | **0.1059** | **-** | **888 B** | **1.00** | +| MEDI | 1 | 2 | 269.8 ns | 103.70 ns | 5.68 ns | 0.48 | 0.01 | 0.1364 | 0.0005 | 1144 B | 1.29 | +| | | | | | | | | | | | | +| **Jab** | **1** | **3** | **829.7 ns** | **353.08 ns** | **19.35 ns** | **1.00** | **0.00** | **0.1554** | **-** | **1304 B** | **1.00** | +| MEDI | 1 | 3 | 384.2 ns | 25.62 ns | 1.40 ns | 0.46 | 0.01 | 0.1864 | 0.0010 | 1560 B | 1.20 | +| | | | | | | | | | | | | +| **Jab** | **10** | **1** | **2,846.8 ns** | **1,643.85 ns** | **90.10 ns** | **1.00** | **0.00** | **0.5608** | **-** | **4720 B** | **1.00** | +| MEDI | 10 | 1 | 1,419.2 ns | 93.91 ns | 5.15 ns | 0.50 | 0.02 | 0.8698 | 0.0019 | 7280 B | 1.54 | +| | | | | | | | | | | | | +| **Jab** | **10** | **2** | **5,674.5 ns** | **1,663.99 ns** | **91.21 ns** | **1.00** | **0.00** | **1.0605** | **-** | **8880 B** | **1.00** | +| MEDI | 10 | 2 | 2,742.9 ns | 1,163.85 ns | 63.79 ns | 0.48 | 0.02 | 1.3657 | 0.0038 | 11440 B | 1.29 | +| | | | | | | | | | | | | +| **Jab** | **10** | **3** | **7,961.3 ns** | **4,443.31 ns** | **243.55 ns** | **1.00** | **0.00** | **1.5564** | **-** | **13040 B** | **1.00** | +| MEDI | 10 | 3 | 3,895.1 ns | 1,591.50 ns | 87.24 ns | 0.49 | 0.02 | 1.8616 | 0.0076 | 15600 B | 1.20 | +| | | | | | | | | | | | | +| **Jab** | **100** | **1** | **29,641.7 ns** | **30,778.23 ns** | **1,687.06 ns** | **1.00** | **0.00** | **5.6152** | **-** | **47200 B** | **1.00** | +| MEDI | 100 | 1 | 14,530.2 ns | 7,006.36 ns | 384.04 ns | 0.49 | 0.01 | 8.6975 | 0.0153 | 72800 B | 1.54 | +| | | | | | | | | | | | | +| **Jab** | **100** | **2** | **54,178.3 ns** | **22,959.21 ns** | **1,258.47 ns** | **1.00** | **0.00** | **10.5591** | **-** | **88800 B** | **1.00** | +| MEDI | 100 | 2 | 26,824.2 ns | 4,858.13 ns | 266.29 ns | 0.50 | 0.01 | 13.6719 | 0.0305 | 114400 B | 1.29 | +| | | | | | | | | | | | | +| **Jab** | **100** | **3** | **92,719.6 ns** | **111,920.74 ns** | **6,134.75 ns** | **1.00** | **0.00** | **15.5029** | **-** | **130400 B** | **1.00** | +| MEDI | 100 | 3 | 39,650.9 ns | 26,436.59 ns | 1,449.08 ns | 0.43 | 0.01 | 18.6157 | 0.0610 | 156000 B | 1.20 | diff --git a/doc/benchmark/Jab.Performance.Basic.Mixed.BasicMixedBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Basic.Mixed.BasicMixedBenchmark-report-github.md index b533a4d..2af1b28 100644 --- a/doc/benchmark/Jab.Performance.Basic.Mixed.BasicMixedBenchmark-report-github.md +++ b/doc/benchmark/Jab.Performance.Basic.Mixed.BasicMixedBenchmark-report-github.md @@ -12,29 +12,29 @@ WarmupCount=3 ``` | Method | NumbersOfCalls | NumbersOfClasses | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio | |------- |--------------- |----------------- |-------------:|-------------:|-----------:|------:|--------:|-------:|----------:|------------:| -| **Jab** | **1** | **1** | **25.80 ns** | **14.068 ns** | **0.771 ns** | **1.00** | **0.00** | **0.0105** | **88 B** | **1.00** | -| MEDI | 1 | 1 | 52.51 ns | 5.150 ns | 0.282 ns | 2.04 | 0.06 | 0.0220 | 184 B | 2.09 | +| **Jab** | **1** | **1** | **25.09 ns** | **2.023 ns** | **0.111 ns** | **1.00** | **0.00** | **0.0105** | **88 B** | **1.00** | +| MEDI | 1 | 1 | 52.97 ns | 5.454 ns | 0.299 ns | 2.11 | 0.02 | 0.0220 | 184 B | 2.09 | | | | | | | | | | | | | -| **Jab** | **1** | **2** | **47.85 ns** | **26.877 ns** | **1.473 ns** | **1.00** | **0.00** | **0.0172** | **144 B** | **1.00** | -| MEDI | 1 | 2 | 71.81 ns | 7.748 ns | 0.425 ns | 1.50 | 0.04 | 0.0286 | 240 B | 1.67 | +| **Jab** | **1** | **2** | **48.33 ns** | **22.718 ns** | **1.245 ns** | **1.00** | **0.00** | **0.0172** | **144 B** | **1.00** | +| MEDI | 1 | 2 | 71.94 ns | 23.674 ns | 1.298 ns | 1.49 | 0.02 | 0.0286 | 240 B | 1.67 | | | | | | | | | | | | | -| **Jab** | **1** | **3** | **73.12 ns** | **23.778 ns** | **1.303 ns** | **1.00** | **0.00** | **0.0238** | **200 B** | **1.00** | -| MEDI | 1 | 3 | 107.44 ns | 25.329 ns | 1.388 ns | 1.47 | 0.02 | 0.0353 | 296 B | 1.48 | +| **Jab** | **1** | **3** | **66.67 ns** | **37.560 ns** | **2.059 ns** | **1.00** | **0.00** | **0.0238** | **200 B** | **1.00** | +| MEDI | 1 | 3 | 111.83 ns | 108.495 ns | 5.947 ns | 1.68 | 0.04 | 0.0353 | 296 B | 1.48 | | | | | | | | | | | | | -| **Jab** | **10** | **1** | **292.33 ns** | **189.259 ns** | **10.374 ns** | **1.00** | **0.00** | **0.1049** | **880 B** | **1.00** | -| MEDI | 10 | 1 | 519.30 ns | 130.190 ns | 7.136 ns | 1.78 | 0.04 | 0.2193 | 1840 B | 2.09 | +| **Jab** | **10** | **1** | **259.18 ns** | **130.556 ns** | **7.156 ns** | **1.00** | **0.00** | **0.1049** | **880 B** | **1.00** | +| MEDI | 10 | 1 | 533.29 ns | 295.258 ns | 16.184 ns | 2.06 | 0.01 | 0.2193 | 1840 B | 2.09 | | | | | | | | | | | | | -| **Jab** | **10** | **2** | **512.16 ns** | **357.840 ns** | **19.614 ns** | **1.00** | **0.00** | **0.1717** | **1440 B** | **1.00** | -| MEDI | 10 | 2 | 751.36 ns | 253.262 ns | 13.882 ns | 1.47 | 0.06 | 0.2861 | 2400 B | 1.67 | +| **Jab** | **10** | **2** | **453.72 ns** | **208.118 ns** | **11.408 ns** | **1.00** | **0.00** | **0.1717** | **1440 B** | **1.00** | +| MEDI | 10 | 2 | 715.44 ns | 228.174 ns | 12.507 ns | 1.58 | 0.01 | 0.2861 | 2400 B | 1.67 | | | | | | | | | | | | | -| **Jab** | **10** | **3** | **710.10 ns** | **990.641 ns** | **54.300 ns** | **1.00** | **0.00** | **0.2384** | **2000 B** | **1.00** | -| MEDI | 10 | 3 | 1,150.01 ns | 313.524 ns | 17.185 ns | 1.63 | 0.14 | 0.3529 | 2960 B | 1.48 | +| **Jab** | **10** | **3** | **664.24 ns** | **323.259 ns** | **17.719 ns** | **1.00** | **0.00** | **0.2384** | **2000 B** | **1.00** | +| MEDI | 10 | 3 | 1,060.66 ns | 691.051 ns | 37.879 ns | 1.60 | 0.10 | 0.3529 | 2960 B | 1.48 | | | | | | | | | | | | | -| **Jab** | **100** | **1** | **2,791.60 ns** | **1,844.990 ns** | **101.130 ns** | **1.00** | **0.00** | **1.0490** | **8800 B** | **1.00** | -| MEDI | 100 | 1 | 5,074.35 ns | 435.927 ns | 23.895 ns | 1.82 | 0.07 | 2.1973 | 18400 B | 2.09 | +| **Jab** | **100** | **1** | **2,587.41 ns** | **1,476.947 ns** | **80.956 ns** | **1.00** | **0.00** | **1.0490** | **8800 B** | **1.00** | +| MEDI | 100 | 1 | 5,068.08 ns | 395.160 ns | 21.660 ns | 1.96 | 0.06 | 2.1973 | 18400 B | 2.09 | | | | | | | | | | | | | -| **Jab** | **100** | **2** | **5,041.48 ns** | **3,862.300 ns** | **211.706 ns** | **1.00** | **0.00** | **1.7166** | **14400 B** | **1.00** | -| MEDI | 100 | 2 | 7,099.86 ns | 245.920 ns | 13.480 ns | 1.41 | 0.06 | 2.8687 | 24000 B | 1.67 | +| **Jab** | **100** | **2** | **4,591.13 ns** | **2,233.109 ns** | **122.404 ns** | **1.00** | **0.00** | **1.7166** | **14400 B** | **1.00** | +| MEDI | 100 | 2 | 7,234.70 ns | 1,964.384 ns | 107.675 ns | 1.58 | 0.06 | 2.8687 | 24000 B | 1.67 | | | | | | | | | | | | | -| **Jab** | **100** | **3** | **7,070.06 ns** | **606.910 ns** | **33.267 ns** | **1.00** | **0.00** | **2.3880** | **20000 B** | **1.00** | -| MEDI | 100 | 3 | 11,248.73 ns | 3,604.232 ns | 197.560 ns | 1.59 | 0.03 | 3.5248 | 29600 B | 1.48 | +| **Jab** | **100** | **3** | **6,837.38 ns** | **2,789.230 ns** | **152.887 ns** | **1.00** | **0.00** | **2.3880** | **20000 B** | **1.00** | +| MEDI | 100 | 3 | 11,699.66 ns | 1,556.090 ns | 85.295 ns | 1.71 | 0.04 | 3.5248 | 29600 B | 1.48 | diff --git a/doc/benchmark/Jab.Performance.Basic.Scoped.BasicScopedBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Basic.Scoped.BasicScopedBenchmark-report-github.md index 70d476d..b31d152 100644 --- a/doc/benchmark/Jab.Performance.Basic.Scoped.BasicScopedBenchmark-report-github.md +++ b/doc/benchmark/Jab.Performance.Basic.Scoped.BasicScopedBenchmark-report-github.md @@ -12,29 +12,29 @@ WarmupCount=3 ``` | Method | NumbersOfCalls | NumbersOfClasses | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio | |------- |--------------- |----------------- |-------------:|------------:|-----------:|------:|--------:|-------:|----------:|------------:| -| **Jab** | **1** | **1** | **26.46 ns** | **16.94 ns** | **0.929 ns** | **1.00** | **0.00** | **0.0095** | **80 B** | **1.00** | -| MEDI | 1 | 1 | 96.85 ns | 21.59 ns | 1.184 ns | 3.66 | 0.09 | 0.0401 | 336 B | 4.20 | +| **Jab** | **1** | **1** | **23.67 ns** | **19.60 ns** | **1.074 ns** | **1.00** | **0.00** | **0.0095** | **80 B** | **1.00** | +| MEDI | 1 | 1 | 101.19 ns | 73.78 ns | 4.044 ns | 4.28 | 0.02 | 0.0401 | 336 B | 4.20 | | | | | | | | | | | | | -| **Jab** | **1** | **2** | **38.25 ns** | **24.26 ns** | **1.330 ns** | **1.00** | **0.00** | **0.0124** | **104 B** | **1.00** | -| MEDI | 1 | 2 | 148.20 ns | 27.80 ns | 1.524 ns | 3.88 | 0.17 | 0.0429 | 360 B | 3.46 | +| **Jab** | **1** | **2** | **34.37 ns** | **21.20 ns** | **1.162 ns** | **1.00** | **0.00** | **0.0124** | **104 B** | **1.00** | +| MEDI | 1 | 2 | 152.44 ns | 48.25 ns | 2.645 ns | 4.44 | 0.08 | 0.0429 | 360 B | 3.46 | | | | | | | | | | | | | -| **Jab** | **1** | **3** | **46.50 ns** | **30.83 ns** | **1.690 ns** | **1.00** | **0.00** | **0.0153** | **128 B** | **1.00** | -| MEDI | 1 | 3 | 210.68 ns | 74.10 ns | 4.061 ns | 4.53 | 0.17 | 0.0458 | 384 B | 3.00 | +| **Jab** | **1** | **3** | **46.67 ns** | **19.28 ns** | **1.057 ns** | **1.00** | **0.00** | **0.0153** | **128 B** | **1.00** | +| MEDI | 1 | 3 | 217.12 ns | 207.52 ns | 11.375 ns | 4.66 | 0.35 | 0.0458 | 384 B | 3.00 | | | | | | | | | | | | | -| **Jab** | **10** | **1** | **252.00 ns** | **288.77 ns** | **15.828 ns** | **1.00** | **0.00** | **0.0954** | **800 B** | **1.00** | -| MEDI | 10 | 1 | 842.07 ns | 149.72 ns | 8.207 ns | 3.35 | 0.18 | 0.4015 | 3360 B | 4.20 | +| **Jab** | **10** | **1** | **213.94 ns** | **34.73 ns** | **1.904 ns** | **1.00** | **0.00** | **0.0956** | **800 B** | **1.00** | +| MEDI | 10 | 1 | 836.62 ns | 30.44 ns | 1.669 ns | 3.91 | 0.04 | 0.4015 | 3360 B | 4.20 | | | | | | | | | | | | | -| **Jab** | **10** | **2** | **367.04 ns** | **230.07 ns** | **12.611 ns** | **1.00** | **0.00** | **0.1240** | **1040 B** | **1.00** | -| MEDI | 10 | 2 | 1,401.19 ns | 598.24 ns | 32.792 ns | 3.82 | 0.09 | 0.4292 | 3600 B | 3.46 | +| **Jab** | **10** | **2** | **327.55 ns** | **154.36 ns** | **8.461 ns** | **1.00** | **0.00** | **0.1240** | **1040 B** | **1.00** | +| MEDI | 10 | 2 | 1,429.73 ns | 1,090.76 ns | 59.788 ns | 4.36 | 0.12 | 0.4292 | 3600 B | 3.46 | | | | | | | | | | | | | -| **Jab** | **10** | **3** | **487.06 ns** | **39.30 ns** | **2.154 ns** | **1.00** | **0.00** | **0.1526** | **1280 B** | **1.00** | -| MEDI | 10 | 3 | 2,031.51 ns | 145.73 ns | 7.988 ns | 4.17 | 0.01 | 0.4578 | 3840 B | 3.00 | +| **Jab** | **10** | **3** | **471.03 ns** | **225.45 ns** | **12.358 ns** | **1.00** | **0.00** | **0.1526** | **1280 B** | **1.00** | +| MEDI | 10 | 3 | 2,067.34 ns | 244.00 ns | 13.374 ns | 4.39 | 0.14 | 0.4578 | 3840 B | 3.00 | | | | | | | | | | | | | -| **Jab** | **100** | **1** | **2,230.61 ns** | **2,696.16 ns** | **147.785 ns** | **1.00** | **0.00** | **0.9537** | **8000 B** | **1.00** | -| MEDI | 100 | 1 | 8,229.42 ns | 619.24 ns | 33.943 ns | 3.70 | 0.25 | 4.0131 | 33600 B | 4.20 | +| **Jab** | **100** | **1** | **2,087.62 ns** | **1,052.17 ns** | **57.673 ns** | **1.00** | **0.00** | **0.9537** | **8000 B** | **1.00** | +| MEDI | 100 | 1 | 8,277.90 ns | 214.87 ns | 11.778 ns | 3.97 | 0.11 | 4.0131 | 33600 B | 4.20 | | | | | | | | | | | | | -| **Jab** | **100** | **2** | **3,568.78 ns** | **2,180.27 ns** | **119.508 ns** | **1.00** | **0.00** | **1.2398** | **10400 B** | **1.00** | -| MEDI | 100 | 2 | 13,334.35 ns | 968.54 ns | 53.089 ns | 3.74 | 0.14 | 4.3030 | 36000 B | 3.46 | +| **Jab** | **100** | **2** | **3,275.71 ns** | **2,345.95 ns** | **128.590 ns** | **1.00** | **0.00** | **1.2398** | **10400 B** | **1.00** | +| MEDI | 100 | 2 | 13,711.81 ns | 3,013.26 ns | 165.167 ns | 4.19 | 0.17 | 4.3030 | 36000 B | 3.46 | | | | | | | | | | | | | -| **Jab** | **100** | **3** | **4,880.04 ns** | **2,369.98 ns** | **129.906 ns** | **1.00** | **0.00** | **1.5259** | **12800 B** | **1.00** | -| MEDI | 100 | 3 | 19,787.89 ns | 1,046.87 ns | 57.382 ns | 4.06 | 0.12 | 4.5776 | 38400 B | 3.00 | +| **Jab** | **100** | **3** | **4,289.60 ns** | **1,056.13 ns** | **57.890 ns** | **1.00** | **0.00** | **1.5259** | **12800 B** | **1.00** | +| MEDI | 100 | 3 | 21,340.73 ns | 657.08 ns | 36.017 ns | 4.98 | 0.07 | 4.5776 | 38400 B | 3.00 | diff --git a/doc/benchmark/Jab.Performance.Basic.Singleton.BasicSingletonBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Basic.Singleton.BasicSingletonBenchmark-report-github.md index 22325a9..2719036 100644 --- a/doc/benchmark/Jab.Performance.Basic.Singleton.BasicSingletonBenchmark-report-github.md +++ b/doc/benchmark/Jab.Performance.Basic.Singleton.BasicSingletonBenchmark-report-github.md @@ -10,31 +10,31 @@ Job=ShortRun IterationCount=3 LaunchCount=1 WarmupCount=3 ``` -| Method | NumbersOfCalls | NumbersOfClasses | Mean | Error | StdDev | Ratio | RatioSD | Allocated | Alloc Ratio | -|------- |--------------- |----------------- |-------------:|------------:|-----------:|------:|--------:|----------:|------------:| -| **Jab** | **1** | **1** | **3.305 ns** | **2.1067 ns** | **0.1155 ns** | **1.00** | **0.00** | **-** | **NA** | -| MEDI | 1 | 1 | 9.419 ns | 6.5332 ns | 0.3581 ns | 2.85 | 0.12 | - | NA | -| | | | | | | | | | | -| **Jab** | **1** | **2** | **4.760 ns** | **3.2599 ns** | **0.1787 ns** | **1.00** | **0.00** | **-** | **NA** | -| MEDI | 1 | 2 | 18.203 ns | 1.0816 ns | 0.0593 ns | 3.83 | 0.14 | - | NA | -| | | | | | | | | | | -| **Jab** | **1** | **3** | **6.606 ns** | **0.0118 ns** | **0.0006 ns** | **1.00** | **0.00** | **-** | **NA** | -| MEDI | 1 | 3 | 32.064 ns | 0.8978 ns | 0.0492 ns | 4.85 | 0.01 | - | NA | -| | | | | | | | | | | -| **Jab** | **10** | **1** | **26.810 ns** | **0.4982 ns** | **0.0273 ns** | **1.00** | **0.00** | **-** | **NA** | -| MEDI | 10 | 1 | 81.013 ns | 2.1421 ns | 0.1174 ns | 3.02 | 0.01 | - | NA | -| | | | | | | | | | | -| **Jab** | **10** | **2** | **46.211 ns** | **0.2974 ns** | **0.0163 ns** | **1.00** | **0.00** | **-** | **NA** | -| MEDI | 10 | 2 | 165.596 ns | 1.0703 ns | 0.0587 ns | 3.58 | 0.00 | - | NA | -| | | | | | | | | | | -| **Jab** | **10** | **3** | **67.257 ns** | **0.8551 ns** | **0.0469 ns** | **1.00** | **0.00** | **-** | **NA** | -| MEDI | 10 | 3 | 293.410 ns | 0.6818 ns | 0.0374 ns | 4.36 | 0.00 | - | NA | -| | | | | | | | | | | -| **Jab** | **100** | **1** | **287.397 ns** | **3.4538 ns** | **0.1893 ns** | **1.00** | **0.00** | **-** | **NA** | -| MEDI | 100 | 1 | 769.830 ns | 36.1949 ns | 1.9840 ns | 2.68 | 0.01 | - | NA | -| | | | | | | | | | | -| **Jab** | **100** | **2** | **478.811 ns** | **231.5772 ns** | **12.6935 ns** | **1.00** | **0.00** | **-** | **NA** | -| MEDI | 100 | 2 | 1,520.578 ns | 25.0371 ns | 1.3724 ns | 3.18 | 0.08 | - | NA | -| | | | | | | | | | | -| **Jab** | **100** | **3** | **698.762 ns** | **129.0059 ns** | **7.0712 ns** | **1.00** | **0.00** | **-** | **NA** | -| MEDI | 100 | 3 | 3,169.651 ns | 814.2630 ns | 44.6325 ns | 4.54 | 0.09 | - | NA | +| Method | NumbersOfCalls | NumbersOfClasses | Mean | Error | StdDev | Ratio | RatioSD | Allocated | Alloc Ratio | +|------- |--------------- |----------------- |-------------:|--------------:|-----------:|------:|--------:|----------:|------------:| +| **Jab** | **1** | **1** | **3.325 ns** | **2.1053 ns** | **0.1154 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 1 | 1 | 9.241 ns | 0.2836 ns | 0.0155 ns | 2.78 | 0.09 | - | NA | +| | | | | | | | | | | +| **Jab** | **1** | **2** | **4.837 ns** | **3.5034 ns** | **0.1920 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 1 | 2 | 19.372 ns | 2.9800 ns | 0.1633 ns | 4.01 | 0.15 | - | NA | +| | | | | | | | | | | +| **Jab** | **1** | **3** | **6.565 ns** | **0.0837 ns** | **0.0046 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 1 | 3 | 33.119 ns | 8.9304 ns | 0.4895 ns | 5.04 | 0.08 | - | NA | +| | | | | | | | | | | +| **Jab** | **10** | **1** | **26.809 ns** | **0.2755 ns** | **0.0151 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 10 | 1 | 80.997 ns | 54.5079 ns | 2.9878 ns | 3.02 | 0.11 | - | NA | +| | | | | | | | | | | +| **Jab** | **10** | **2** | **46.329 ns** | **1.9780 ns** | **0.1084 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 10 | 2 | 159.078 ns | 4.0941 ns | 0.2244 ns | 3.43 | 0.00 | - | NA | +| | | | | | | | | | | +| **Jab** | **10** | **3** | **67.262 ns** | **0.8269 ns** | **0.0453 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 10 | 3 | 315.013 ns | 127.0110 ns | 6.9619 ns | 4.68 | 0.10 | - | NA | +| | | | | | | | | | | +| **Jab** | **100** | **1** | **274.527 ns** | **0.7776 ns** | **0.0426 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 100 | 1 | 796.947 ns | 773.4009 ns | 42.3927 ns | 2.90 | 0.15 | - | NA | +| | | | | | | | | | | +| **Jab** | **100** | **2** | **471.125 ns** | **3.6747 ns** | **0.2014 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 100 | 2 | 1,515.981 ns | 46.7398 ns | 2.5620 ns | 3.22 | 0.00 | - | NA | +| | | | | | | | | | | +| **Jab** | **100** | **3** | **697.216 ns** | **110.1225 ns** | **6.0362 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 100 | 3 | 2,931.081 ns | 1,071.4105 ns | 58.7276 ns | 4.20 | 0.12 | - | NA | diff --git a/doc/benchmark/Jab.Performance.Basic.Transient.BasicTransientBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Basic.Transient.BasicTransientBenchmark-report-github.md index c9f721b..688c21d 100644 --- a/doc/benchmark/Jab.Performance.Basic.Transient.BasicTransientBenchmark-report-github.md +++ b/doc/benchmark/Jab.Performance.Basic.Transient.BasicTransientBenchmark-report-github.md @@ -10,31 +10,31 @@ Job=ShortRun IterationCount=3 LaunchCount=1 WarmupCount=3 ``` -| Method | NumbersOfCalls | NumbersOfClasses | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio | -|------- |--------------- |----------------- |------------:|-------------:|-----------:|------:|--------:|-------:|----------:|------------:| -| **Jab** | **1** | **1** | **11.33 ns** | **5.879 ns** | **0.322 ns** | **1.00** | **0.00** | **0.0029** | **24 B** | **1.00** | -| MEDI | 1 | 1 | 14.12 ns | 3.393 ns | 0.186 ns | 1.25 | 0.02 | 0.0029 | 24 B | 1.00 | -| | | | | | | | | | | | -| **Jab** | **1** | **2** | **20.91 ns** | **4.753 ns** | **0.261 ns** | **1.00** | **0.00** | **0.0057** | **48 B** | **1.00** | -| MEDI | 1 | 2 | 26.62 ns | 7.297 ns | 0.400 ns | 1.27 | 0.02 | 0.0057 | 48 B | 1.00 | -| | | | | | | | | | | | -| **Jab** | **1** | **3** | **28.92 ns** | **0.939 ns** | **0.051 ns** | **1.00** | **0.00** | **0.0086** | **72 B** | **1.00** | -| MEDI | 1 | 3 | 38.40 ns | 46.302 ns | 2.538 ns | 1.33 | 0.09 | 0.0086 | 72 B | 1.00 | -| | | | | | | | | | | | -| **Jab** | **10** | **1** | **112.80 ns** | **36.870 ns** | **2.021 ns** | **1.00** | **0.00** | **0.0286** | **240 B** | **1.00** | -| MEDI | 10 | 1 | 134.00 ns | 57.506 ns | 3.152 ns | 1.19 | 0.02 | 0.0286 | 240 B | 1.00 | -| | | | | | | | | | | | -| **Jab** | **10** | **2** | **210.40 ns** | **65.697 ns** | **3.601 ns** | **1.00** | **0.00** | **0.0572** | **480 B** | **1.00** | -| MEDI | 10 | 2 | 256.86 ns | 122.244 ns | 6.701 ns | 1.22 | 0.02 | 0.0572 | 480 B | 1.00 | -| | | | | | | | | | | | -| **Jab** | **10** | **3** | **307.42 ns** | **107.202 ns** | **5.876 ns** | **1.00** | **0.00** | **0.0858** | **720 B** | **1.00** | -| MEDI | 10 | 3 | 405.50 ns | 210.375 ns | 11.531 ns | 1.32 | 0.03 | 0.0858 | 720 B | 1.00 | -| | | | | | | | | | | | -| **Jab** | **100** | **1** | **1,014.30 ns** | **67.634 ns** | **3.707 ns** | **1.00** | **0.00** | **0.2861** | **2400 B** | **1.00** | -| MEDI | 100 | 1 | 1,198.04 ns | 1,693.470 ns | 92.825 ns | 1.18 | 0.09 | 0.2861 | 2400 B | 1.00 | -| | | | | | | | | | | | -| **Jab** | **100** | **2** | **1,967.15 ns** | **153.610 ns** | **8.420 ns** | **1.00** | **0.00** | **0.5722** | **4800 B** | **1.00** | -| MEDI | 100 | 2 | 2,430.37 ns | 427.372 ns | 23.426 ns | 1.24 | 0.01 | 0.5722 | 4800 B | 1.00 | -| | | | | | | | | | | | -| **Jab** | **100** | **3** | **3,018.39 ns** | **1,815.571 ns** | **99.518 ns** | **1.00** | **0.00** | **0.8583** | **7200 B** | **1.00** | -| MEDI | 100 | 3 | 3,681.80 ns | 4,709.551 ns | 258.146 ns | 1.22 | 0.11 | 0.8583 | 7200 B | 1.00 | +| Method | NumbersOfCalls | NumbersOfClasses | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio | +|------- |--------------- |----------------- |------------:|-------------:|----------:|------:|--------:|-------:|----------:|------------:| +| **Jab** | **1** | **1** | **11.29 ns** | **3.599 ns** | **0.197 ns** | **1.00** | **0.00** | **0.0029** | **24 B** | **1.00** | +| MEDI | 1 | 1 | 13.46 ns | 1.805 ns | 0.099 ns | 1.19 | 0.03 | 0.0029 | 24 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **1** | **2** | **20.25 ns** | **7.009 ns** | **0.384 ns** | **1.00** | **0.00** | **0.0057** | **48 B** | **1.00** | +| MEDI | 1 | 2 | 23.77 ns | 9.372 ns | 0.514 ns | 1.17 | 0.01 | 0.0057 | 48 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **1** | **3** | **29.03 ns** | **4.606 ns** | **0.252 ns** | **1.00** | **0.00** | **0.0086** | **72 B** | **1.00** | +| MEDI | 1 | 3 | 37.82 ns | 9.078 ns | 0.498 ns | 1.30 | 0.01 | 0.0086 | 72 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **10** | **1** | **111.14 ns** | **22.419 ns** | **1.229 ns** | **1.00** | **0.00** | **0.0286** | **240 B** | **1.00** | +| MEDI | 10 | 1 | 118.71 ns | 39.801 ns | 2.182 ns | 1.07 | 0.01 | 0.0286 | 240 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **10** | **2** | **210.33 ns** | **57.729 ns** | **3.164 ns** | **1.00** | **0.00** | **0.0572** | **480 B** | **1.00** | +| MEDI | 10 | 2 | 223.64 ns | 71.343 ns | 3.911 ns | 1.06 | 0.00 | 0.0572 | 480 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **10** | **3** | **307.94 ns** | **137.909 ns** | **7.559 ns** | **1.00** | **0.00** | **0.0858** | **720 B** | **1.00** | +| MEDI | 10 | 3 | 349.57 ns | 87.643 ns | 4.804 ns | 1.14 | 0.01 | 0.0858 | 720 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **100** | **1** | **1,020.25 ns** | **108.017 ns** | **5.921 ns** | **1.00** | **0.00** | **0.2861** | **2400 B** | **1.00** | +| MEDI | 100 | 1 | 1,087.17 ns | 63.708 ns | 3.492 ns | 1.07 | 0.00 | 0.2861 | 2400 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **100** | **2** | **1,979.40 ns** | **83.344 ns** | **4.568 ns** | **1.00** | **0.00** | **0.5722** | **4800 B** | **1.00** | +| MEDI | 100 | 2 | 2,132.88 ns | 410.046 ns | 22.476 ns | 1.08 | 0.01 | 0.5722 | 4800 B | 1.00 | +| | | | | | | | | | | | +| **Jab** | **100** | **3** | **3,005.02 ns** | **1,288.631 ns** | **70.634 ns** | **1.00** | **0.00** | **0.8583** | **7200 B** | **1.00** | +| MEDI | 100 | 3 | 3,384.20 ns | 1,181.026 ns | 64.736 ns | 1.13 | 0.01 | 0.8583 | 7200 B | 1.00 | diff --git a/doc/benchmark/Jab.Performance.Deep.Mixed.DeepMixedBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Deep.Mixed.DeepMixedBenchmark-report-github.md index e3a5e79..063199b 100644 --- a/doc/benchmark/Jab.Performance.Deep.Mixed.DeepMixedBenchmark-report-github.md +++ b/doc/benchmark/Jab.Performance.Deep.Mixed.DeepMixedBenchmark-report-github.md @@ -12,29 +12,29 @@ WarmupCount=3 ``` | Method | NumbersOfCalls | Deep | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio | |------- |--------------- |----- |------------:|-------------:|-----------:|------:|--------:|-------:|----------:|------------:| -| **Jab** | **1** | **1** | **26.94 ns** | **11.260 ns** | **0.617 ns** | **1.00** | **0.00** | **0.0105** | **88 B** | **1.00** | -| MEDI | 1 | 1 | 57.11 ns | 47.088 ns | 2.581 ns | 2.12 | 0.14 | 0.0219 | 184 B | 2.09 | +| **Jab** | **1** | **1** | **25.62 ns** | **0.943 ns** | **0.052 ns** | **1.00** | **0.00** | **0.0105** | **88 B** | **1.00** | +| MEDI | 1 | 1 | 52.09 ns | 2.505 ns | 0.137 ns | 2.03 | 0.00 | 0.0220 | 184 B | 2.09 | | | | | | | | | | | | | -| **Jab** | **1** | **10** | **25.78 ns** | **0.474 ns** | **0.026 ns** | **1.00** | **0.00** | **0.0105** | **88 B** | **1.00** | -| MEDI | 1 | 10 | 53.43 ns | 21.806 ns | 1.195 ns | 2.07 | 0.05 | 0.0219 | 184 B | 2.09 | +| **Jab** | **1** | **10** | **25.87 ns** | **0.497 ns** | **0.027 ns** | **1.00** | **0.00** | **0.0105** | **88 B** | **1.00** | +| MEDI | 1 | 10 | 52.40 ns | 6.464 ns | 0.354 ns | 2.03 | 0.01 | 0.0220 | 184 B | 2.09 | | | | | | | | | | | | | -| **Jab** | **1** | **100** | **26.80 ns** | **26.672 ns** | **1.462 ns** | **1.00** | **0.00** | **0.0105** | **88 B** | **1.00** | -| MEDI | 1 | 100 | 58.44 ns | 71.548 ns | 3.922 ns | 2.18 | 0.14 | 0.0219 | 184 B | 2.09 | +| **Jab** | **1** | **100** | **25.91 ns** | **3.496 ns** | **0.192 ns** | **1.00** | **0.00** | **0.0105** | **88 B** | **1.00** | +| MEDI | 1 | 100 | 53.08 ns | 19.160 ns | 1.050 ns | 2.05 | 0.05 | 0.0219 | 184 B | 2.09 | | | | | | | | | | | | | -| **Jab** | **10** | **1** | **281.17 ns** | **478.602 ns** | **26.234 ns** | **1.00** | **0.00** | **0.1049** | **880 B** | **1.00** | -| MEDI | 10 | 1 | 542.59 ns | 322.762 ns | 17.692 ns | 1.94 | 0.12 | 0.2193 | 1840 B | 2.09 | +| **Jab** | **10** | **1** | **260.54 ns** | **187.914 ns** | **10.300 ns** | **1.00** | **0.00** | **0.1049** | **880 B** | **1.00** | +| MEDI | 10 | 1 | 605.84 ns | 316.193 ns | 17.332 ns | 2.33 | 0.05 | 0.2193 | 1840 B | 2.09 | | | | | | | | | | | | | -| **Jab** | **10** | **10** | **278.47 ns** | **157.738 ns** | **8.646 ns** | **1.00** | **0.00** | **0.1049** | **880 B** | **1.00** | -| MEDI | 10 | 10 | 540.72 ns | 439.471 ns | 24.089 ns | 1.94 | 0.13 | 0.2193 | 1840 B | 2.09 | +| **Jab** | **10** | **10** | **294.07 ns** | **287.226 ns** | **15.744 ns** | **1.00** | **0.00** | **0.1049** | **880 B** | **1.00** | +| MEDI | 10 | 10 | 535.70 ns | 446.552 ns | 24.477 ns | 1.82 | 0.07 | 0.2193 | 1840 B | 2.09 | | | | | | | | | | | | | -| **Jab** | **10** | **100** | **307.36 ns** | **173.688 ns** | **9.520 ns** | **1.00** | **0.00** | **0.1049** | **880 B** | **1.00** | -| MEDI | 10 | 100 | 543.88 ns | 274.627 ns | 15.053 ns | 1.77 | 0.06 | 0.2193 | 1840 B | 2.09 | +| **Jab** | **10** | **100** | **283.91 ns** | **193.142 ns** | **10.587 ns** | **1.00** | **0.00** | **0.1049** | **880 B** | **1.00** | +| MEDI | 10 | 100 | 539.58 ns | 440.578 ns | 24.150 ns | 1.90 | 0.14 | 0.2193 | 1840 B | 2.09 | | | | | | | | | | | | | -| **Jab** | **100** | **1** | **2,587.16 ns** | **3,486.341 ns** | **191.098 ns** | **1.00** | **0.00** | **1.0490** | **8800 B** | **1.00** | -| MEDI | 100 | 1 | 5,222.47 ns | 1,059.804 ns | 58.091 ns | 2.03 | 0.15 | 2.1973 | 18400 B | 2.09 | +| **Jab** | **100** | **1** | **2,548.43 ns** | **1,692.380 ns** | **92.765 ns** | **1.00** | **0.00** | **1.0490** | **8800 B** | **1.00** | +| MEDI | 100 | 1 | 5,064.82 ns | 934.450 ns | 51.220 ns | 1.99 | 0.07 | 2.1973 | 18400 B | 2.09 | | | | | | | | | | | | | -| **Jab** | **100** | **10** | **2,942.41 ns** | **1,713.042 ns** | **93.898 ns** | **1.00** | **0.00** | **1.0490** | **8800 B** | **1.00** | -| MEDI | 100 | 10 | 5,672.47 ns | 328.126 ns | 17.986 ns | 1.93 | 0.07 | 2.1973 | 18400 B | 2.09 | +| **Jab** | **100** | **10** | **2,780.62 ns** | **2,363.702 ns** | **129.562 ns** | **1.00** | **0.00** | **1.0490** | **8800 B** | **1.00** | +| MEDI | 100 | 10 | 5,176.53 ns | 1,979.947 ns | 108.528 ns | 1.86 | 0.06 | 2.1973 | 18400 B | 2.09 | | | | | | | | | | | | | -| **Jab** | **100** | **100** | **2,972.94 ns** | **1,335.825 ns** | **73.221 ns** | **1.00** | **0.00** | **1.0490** | **8800 B** | **1.00** | -| MEDI | 100 | 100 | 5,038.35 ns | 502.338 ns | 27.535 ns | 1.70 | 0.05 | 2.1973 | 18400 B | 2.09 | +| **Jab** | **100** | **100** | **2,698.47 ns** | **688.095 ns** | **37.717 ns** | **1.00** | **0.00** | **1.0490** | **8800 B** | **1.00** | +| MEDI | 100 | 100 | 5,052.23 ns | 929.174 ns | 50.931 ns | 1.87 | 0.05 | 2.1973 | 18400 B | 2.09 | diff --git a/doc/benchmark/Jab.Performance.Deep.Scoped.DeepScopedBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Deep.Scoped.DeepScopedBenchmark-report-github.md index 676a00d..526dfea 100644 --- a/doc/benchmark/Jab.Performance.Deep.Scoped.DeepScopedBenchmark-report-github.md +++ b/doc/benchmark/Jab.Performance.Deep.Scoped.DeepScopedBenchmark-report-github.md @@ -10,31 +10,31 @@ Job=ShortRun IterationCount=3 LaunchCount=1 WarmupCount=3 ``` -| Method | NumbersOfCalls | Deep | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Gen1 | Allocated | Alloc Ratio | -|------- |--------------- |----- |-------------:|-------------:|-------------:|------:|--------:|--------:|-------:|----------:|------------:| -| **Jab** | **1** | **1** | **212.63 ns** | **156.92 ns** | **8.602 ns** | **1.00** | **0.00** | **0.1023** | **0.0002** | **856 B** | **1.00** | -| MEDI | 1 | 1 | 97.70 ns | 73.44 ns | 4.026 ns | 0.46 | 0.01 | 0.0401 | - | 336 B | 0.39 | -| | | | | | | | | | | | | -| **Jab** | **1** | **10** | **209.61 ns** | **77.34 ns** | **4.239 ns** | **1.00** | **0.00** | **0.1023** | **0.0002** | **856 B** | **1.00** | -| MEDI | 1 | 10 | 87.64 ns | 52.89 ns | 2.899 ns | 0.42 | 0.02 | 0.0401 | - | 336 B | 0.39 | -| | | | | | | | | | | | | -| **Jab** | **1** | **100** | **206.04 ns** | **72.77 ns** | **3.989 ns** | **1.00** | **0.00** | **0.1023** | **0.0002** | **856 B** | **1.00** | -| MEDI | 1 | 100 | 92.20 ns | 72.93 ns | 3.997 ns | 0.45 | 0.02 | 0.0401 | - | 336 B | 0.39 | -| | | | | | | | | | | | | -| **Jab** | **10** | **1** | **1,961.15 ns** | **159.24 ns** | **8.729 ns** | **1.00** | **0.00** | **1.0223** | **-** | **8560 B** | **1.00** | -| MEDI | 10 | 1 | 907.53 ns | 482.66 ns | 26.456 ns | 0.46 | 0.02 | 0.4015 | - | 3360 B | 0.39 | -| | | | | | | | | | | | | -| **Jab** | **10** | **10** | **2,144.65 ns** | **119.12 ns** | **6.529 ns** | **1.00** | **0.00** | **1.0223** | **-** | **8560 B** | **1.00** | -| MEDI | 10 | 10 | 949.59 ns | 369.82 ns | 20.271 ns | 0.44 | 0.01 | 0.4015 | - | 3360 B | 0.39 | -| | | | | | | | | | | | | -| **Jab** | **10** | **100** | **1,931.06 ns** | **243.37 ns** | **13.340 ns** | **1.00** | **0.00** | **1.0223** | **-** | **8560 B** | **1.00** | -| MEDI | 10 | 100 | 1,019.13 ns | 778.85 ns | 42.692 ns | 0.53 | 0.03 | 0.4005 | - | 3360 B | 0.39 | -| | | | | | | | | | | | | -| **Jab** | **100** | **1** | **19,513.04 ns** | **7,023.74 ns** | **384.995 ns** | **1.00** | **0.00** | **10.2234** | **0.0305** | **85600 B** | **1.00** | -| MEDI | 100 | 1 | 8,973.90 ns | 3,427.00 ns | 187.845 ns | 0.46 | 0.01 | 4.0131 | - | 33600 B | 0.39 | -| | | | | | | | | | | | | -| **Jab** | **100** | **10** | **22,074.98 ns** | **1,970.06 ns** | **107.986 ns** | **1.00** | **0.00** | **10.2234** | **0.0305** | **85600 B** | **1.00** | -| MEDI | 100 | 10 | 8,702.05 ns | 3,420.80 ns | 187.506 ns | 0.39 | 0.01 | 4.0131 | - | 33600 B | 0.39 | -| | | | | | | | | | | | | -| **Jab** | **100** | **100** | **20,437.55 ns** | **22,317.04 ns** | **1,223.272 ns** | **1.00** | **0.00** | **10.2234** | **0.0305** | **85600 B** | **1.00** | -| MEDI | 100 | 100 | 8,516.09 ns | 1,294.09 ns | 70.934 ns | 0.42 | 0.03 | 4.0131 | - | 33600 B | 0.39 | +| Method | NumbersOfCalls | Deep | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Gen1 | Allocated | Alloc Ratio | +|------- |--------------- |----- |-------------:|------------:|-----------:|------:|--------:|--------:|-------:|----------:|------------:| +| **Jab** | **1** | **1** | **193.53 ns** | **34.60 ns** | **1.897 ns** | **1.00** | **0.00** | **0.1023** | **0.0002** | **856 B** | **1.00** | +| MEDI | 1 | 1 | 94.58 ns | 66.75 ns | 3.659 ns | 0.49 | 0.02 | 0.0401 | - | 336 B | 0.39 | +| | | | | | | | | | | | | +| **Jab** | **1** | **10** | **196.28 ns** | **25.64 ns** | **1.405 ns** | **1.00** | **0.00** | **0.1023** | **0.0002** | **856 B** | **1.00** | +| MEDI | 1 | 10 | 91.62 ns | 51.10 ns | 2.801 ns | 0.47 | 0.01 | 0.0401 | - | 336 B | 0.39 | +| | | | | | | | | | | | | +| **Jab** | **1** | **100** | **200.93 ns** | **115.21 ns** | **6.315 ns** | **1.00** | **0.00** | **0.1023** | **0.0002** | **856 B** | **1.00** | +| MEDI | 1 | 100 | 90.20 ns | 74.15 ns | 4.065 ns | 0.45 | 0.03 | 0.0401 | - | 336 B | 0.39 | +| | | | | | | | | | | | | +| **Jab** | **10** | **1** | **1,982.29 ns** | **1,454.89 ns** | **79.747 ns** | **1.00** | **0.00** | **1.0223** | **0.0019** | **8560 B** | **1.00** | +| MEDI | 10 | 1 | 834.97 ns | 109.58 ns | 6.006 ns | 0.42 | 0.02 | 0.4015 | - | 3360 B | 0.39 | +| | | | | | | | | | | | | +| **Jab** | **10** | **10** | **2,035.80 ns** | **460.14 ns** | **25.222 ns** | **1.00** | **0.00** | **1.0223** | **-** | **8560 B** | **1.00** | +| MEDI | 10 | 10 | 902.20 ns | 603.22 ns | 33.065 ns | 0.44 | 0.01 | 0.4015 | - | 3360 B | 0.39 | +| | | | | | | | | | | | | +| **Jab** | **10** | **100** | **2,100.85 ns** | **2,662.20 ns** | **145.924 ns** | **1.00** | **0.00** | **1.0223** | **-** | **8560 B** | **1.00** | +| MEDI | 10 | 100 | 855.43 ns | 178.70 ns | 9.795 ns | 0.41 | 0.02 | 0.4015 | - | 3360 B | 0.39 | +| | | | | | | | | | | | | +| **Jab** | **100** | **1** | **19,231.59 ns** | **4,371.35 ns** | **239.608 ns** | **1.00** | **0.00** | **10.2234** | **0.0305** | **85600 B** | **1.00** | +| MEDI | 100 | 1 | 9,127.87 ns | 4,526.74 ns | 248.126 ns | 0.47 | 0.02 | 4.0131 | - | 33600 B | 0.39 | +| | | | | | | | | | | | | +| **Jab** | **100** | **10** | **18,944.31 ns** | **2,744.54 ns** | **150.438 ns** | **1.00** | **0.00** | **10.2234** | **0.0305** | **85600 B** | **1.00** | +| MEDI | 100 | 10 | 8,742.21 ns | 214.87 ns | 11.778 ns | 0.46 | 0.00 | 4.0131 | - | 33600 B | 0.39 | +| | | | | | | | | | | | | +| **Jab** | **100** | **100** | **18,962.96 ns** | **1,583.78 ns** | **86.812 ns** | **1.00** | **0.00** | **10.2234** | **0.0305** | **85600 B** | **1.00** | +| MEDI | 100 | 100 | 9,046.63 ns | 6,771.93 ns | 371.193 ns | 0.48 | 0.02 | 4.0131 | - | 33600 B | 0.39 | diff --git a/doc/benchmark/Jab.Performance.Deep.Singleton.DeepSingletonBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Deep.Singleton.DeepSingletonBenchmark-report-github.md index a4253d2..36f9775 100644 --- a/doc/benchmark/Jab.Performance.Deep.Singleton.DeepSingletonBenchmark-report-github.md +++ b/doc/benchmark/Jab.Performance.Deep.Singleton.DeepSingletonBenchmark-report-github.md @@ -10,31 +10,31 @@ Job=ShortRun IterationCount=3 LaunchCount=1 WarmupCount=3 ``` -| Method | NumbersOfCalls | Deep | Mean | Error | StdDev | Ratio | RatioSD | Allocated | Alloc Ratio | -|------- |--------------- |----- |-----------:|------------:|-----------:|------:|--------:|----------:|------------:| -| **Jab** | **1** | **1** | **3.297 ns** | **1.8021 ns** | **0.0988 ns** | **1.00** | **0.00** | **-** | **NA** | -| MEDI | 1 | 1 | 9.320 ns | 0.9370 ns | 0.0514 ns | 2.83 | 0.09 | - | NA | -| | | | | | | | | | | -| **Jab** | **1** | **10** | **3.158 ns** | **0.2176 ns** | **0.0119 ns** | **1.00** | **0.00** | **-** | **NA** | -| MEDI | 1 | 10 | 9.526 ns | 1.1012 ns | 0.0604 ns | 3.02 | 0.01 | - | NA | -| | | | | | | | | | | -| **Jab** | **1** | **100** | **3.004 ns** | **0.1847 ns** | **0.0101 ns** | **1.00** | **0.00** | **-** | **NA** | -| MEDI | 1 | 100 | 9.722 ns | 0.9311 ns | 0.0510 ns | 3.24 | 0.01 | - | NA | -| | | | | | | | | | | -| **Jab** | **10** | **1** | **27.939 ns** | **1.0508 ns** | **0.0576 ns** | **1.00** | **0.00** | **-** | **NA** | -| MEDI | 10 | 1 | 82.556 ns | 40.5199 ns | 2.2210 ns | 2.95 | 0.08 | - | NA | -| | | | | | | | | | | -| **Jab** | **10** | **10** | **29.781 ns** | **0.5570 ns** | **0.0305 ns** | **1.00** | **0.00** | **-** | **NA** | -| MEDI | 10 | 10 | 78.532 ns | 21.6593 ns | 1.1872 ns | 2.64 | 0.04 | - | NA | -| | | | | | | | | | | -| **Jab** | **10** | **100** | **29.616 ns** | **0.3370 ns** | **0.0185 ns** | **1.00** | **0.00** | **-** | **NA** | -| MEDI | 10 | 100 | 81.977 ns | 15.6892 ns | 0.8600 ns | 2.77 | 0.03 | - | NA | -| | | | | | | | | | | -| **Jab** | **100** | **1** | **275.846 ns** | **2.6353 ns** | **0.1445 ns** | **1.00** | **0.00** | **-** | **NA** | -| MEDI | 100 | 1 | 786.527 ns | 303.4739 ns | 16.6344 ns | 2.85 | 0.06 | - | NA | -| | | | | | | | | | | -| **Jab** | **100** | **10** | **306.175 ns** | **5.7135 ns** | **0.3132 ns** | **1.00** | **0.00** | **-** | **NA** | -| MEDI | 100 | 10 | 772.480 ns | 80.7704 ns | 4.4273 ns | 2.52 | 0.01 | - | NA | -| | | | | | | | | | | -| **Jab** | **100** | **100** | **301.953 ns** | **2.8402 ns** | **0.1557 ns** | **1.00** | **0.00** | **-** | **NA** | -| MEDI | 100 | 100 | 791.760 ns | 318.5198 ns | 17.4591 ns | 2.62 | 0.06 | - | NA | +| Method | NumbersOfCalls | Deep | Mean | Error | StdDev | Ratio | RatioSD | Allocated | Alloc Ratio | +|------- |--------------- |----- |-----------:|------------:|----------:|------:|--------:|----------:|------------:| +| **Jab** | **1** | **1** | **3.224 ns** | **0.5634 ns** | **0.0309 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 1 | 1 | 9.231 ns | 0.2059 ns | 0.0113 ns | 2.86 | 0.03 | - | NA | +| | | | | | | | | | | +| **Jab** | **1** | **10** | **3.132 ns** | **0.1785 ns** | **0.0098 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 1 | 10 | 9.387 ns | 0.0661 ns | 0.0036 ns | 3.00 | 0.01 | - | NA | +| | | | | | | | | | | +| **Jab** | **1** | **100** | **3.147 ns** | **2.4405 ns** | **0.1338 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 1 | 100 | 9.904 ns | 4.3190 ns | 0.2367 ns | 3.15 | 0.21 | - | NA | +| | | | | | | | | | | +| **Jab** | **10** | **1** | **27.309 ns** | **3.0349 ns** | **0.1664 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 10 | 1 | 78.642 ns | 14.0010 ns | 0.7674 ns | 2.88 | 0.03 | - | NA | +| | | | | | | | | | | +| **Jab** | **10** | **10** | **29.808 ns** | **0.2199 ns** | **0.0121 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 10 | 10 | 77.983 ns | 0.9044 ns | 0.0496 ns | 2.62 | 0.00 | - | NA | +| | | | | | | | | | | +| **Jab** | **10** | **100** | **30.915 ns** | **14.0810 ns** | **0.7718 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 10 | 100 | 77.438 ns | 3.6644 ns | 0.2009 ns | 2.51 | 0.07 | - | NA | +| | | | | | | | | | | +| **Jab** | **100** | **1** | **289.499 ns** | **29.4989 ns** | **1.6169 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 100 | 1 | 768.373 ns | 15.8038 ns | 0.8663 ns | 2.65 | 0.02 | - | NA | +| | | | | | | | | | | +| **Jab** | **100** | **10** | **312.253 ns** | **175.4458 ns** | **9.6168 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 100 | 10 | 767.738 ns | 11.4037 ns | 0.6251 ns | 2.46 | 0.08 | - | NA | +| | | | | | | | | | | +| **Jab** | **100** | **100** | **302.608 ns** | **52.9755 ns** | **2.9038 ns** | **1.00** | **0.00** | **-** | **NA** | +| MEDI | 100 | 100 | 768.834 ns | 5.1336 ns | 0.2814 ns | 2.54 | 0.02 | - | NA | diff --git a/doc/benchmark/Jab.Performance.Deep.Transient.DeepTransientBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Deep.Transient.DeepTransientBenchmark-report-github.md index 0f117ab..f3d40b6 100644 --- a/doc/benchmark/Jab.Performance.Deep.Transient.DeepTransientBenchmark-report-github.md +++ b/doc/benchmark/Jab.Performance.Deep.Transient.DeepTransientBenchmark-report-github.md @@ -12,29 +12,29 @@ WarmupCount=3 ``` | Method | NumbersOfCalls | Deep | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio | |------- |--------------- |----- |------------:|-----------:|----------:|------:|--------:|-------:|----------:|------------:| -| **Jab** | **1** | **1** | **11.38 ns** | **2.843 ns** | **0.156 ns** | **1.00** | **0.00** | **0.0029** | **24 B** | **1.00** | -| MEDI | 1 | 1 | 15.48 ns | 1.107 ns | 0.061 ns | 1.36 | 0.02 | 0.0029 | 24 B | 1.00 | +| **Jab** | **1** | **1** | **11.87 ns** | **3.635 ns** | **0.199 ns** | **1.00** | **0.00** | **0.0029** | **24 B** | **1.00** | +| MEDI | 1 | 1 | 14.34 ns | 12.773 ns | 0.700 ns | 1.21 | 0.07 | 0.0029 | 24 B | 1.00 | | | | | | | | | | | | | -| **Jab** | **1** | **10** | **11.58 ns** | **4.950 ns** | **0.271 ns** | **1.00** | **0.00** | **0.0029** | **24 B** | **1.00** | -| MEDI | 1 | 10 | 14.52 ns | 7.889 ns | 0.432 ns | 1.25 | 0.03 | 0.0029 | 24 B | 1.00 | +| **Jab** | **1** | **10** | **11.66 ns** | **4.816 ns** | **0.264 ns** | **1.00** | **0.00** | **0.0029** | **24 B** | **1.00** | +| MEDI | 1 | 10 | 13.76 ns | 1.981 ns | 0.109 ns | 1.18 | 0.04 | 0.0029 | 24 B | 1.00 | | | | | | | | | | | | | -| **Jab** | **1** | **100** | **11.93 ns** | **6.984 ns** | **0.383 ns** | **1.00** | **0.00** | **0.0029** | **24 B** | **1.00** | -| MEDI | 1 | 100 | 14.17 ns | 1.164 ns | 0.064 ns | 1.19 | 0.03 | 0.0029 | 24 B | 1.00 | +| **Jab** | **1** | **100** | **24.99 ns** | **6.421 ns** | **0.352 ns** | **1.00** | **0.00** | **0.0029** | **24 B** | **1.00** | +| MEDI | 1 | 100 | 14.60 ns | 15.991 ns | 0.877 ns | 0.58 | 0.04 | 0.0029 | 24 B | 1.00 | | | | | | | | | | | | | -| **Jab** | **10** | **1** | **119.07 ns** | **57.469 ns** | **3.150 ns** | **1.00** | **0.00** | **0.0286** | **240 B** | **1.00** | -| MEDI | 10 | 1 | 114.72 ns | 14.546 ns | 0.797 ns | 0.96 | 0.03 | 0.0286 | 240 B | 1.00 | +| **Jab** | **10** | **1** | **116.36 ns** | **39.374 ns** | **2.158 ns** | **1.00** | **0.00** | **0.0286** | **240 B** | **1.00** | +| MEDI | 10 | 1 | 116.72 ns | 68.128 ns | 3.734 ns | 1.00 | 0.05 | 0.0286 | 240 B | 1.00 | | | | | | | | | | | | | -| **Jab** | **10** | **10** | **123.94 ns** | **29.047 ns** | **1.592 ns** | **1.00** | **0.00** | **0.0286** | **240 B** | **1.00** | -| MEDI | 10 | 10 | 116.57 ns | 41.713 ns | 2.286 ns | 0.94 | 0.02 | 0.0286 | 240 B | 1.00 | +| **Jab** | **10** | **10** | **116.33 ns** | **21.723 ns** | **1.191 ns** | **1.00** | **0.00** | **0.0286** | **240 B** | **1.00** | +| MEDI | 10 | 10 | 117.22 ns | 44.031 ns | 2.413 ns | 1.01 | 0.02 | 0.0286 | 240 B | 1.00 | | | | | | | | | | | | | -| **Jab** | **10** | **100** | **116.56 ns** | **96.826 ns** | **5.307 ns** | **1.00** | **0.00** | **0.0286** | **240 B** | **1.00** | -| MEDI | 10 | 100 | 115.82 ns | 37.100 ns | 2.034 ns | 1.00 | 0.06 | 0.0286 | 240 B | 1.00 | +| **Jab** | **10** | **100** | **113.57 ns** | **60.298 ns** | **3.305 ns** | **1.00** | **0.00** | **0.0286** | **240 B** | **1.00** | +| MEDI | 10 | 100 | 117.62 ns | 92.014 ns | 5.044 ns | 1.04 | 0.07 | 0.0286 | 240 B | 1.00 | | | | | | | | | | | | | -| **Jab** | **100** | **1** | **1,037.03 ns** | **117.815 ns** | **6.458 ns** | **1.00** | **0.00** | **0.2861** | **2400 B** | **1.00** | -| MEDI | 100 | 1 | 1,098.06 ns | 109.267 ns | 5.989 ns | 1.06 | 0.01 | 0.2861 | 2400 B | 1.00 | +| **Jab** | **100** | **1** | **1,033.44 ns** | **106.497 ns** | **5.837 ns** | **1.00** | **0.00** | **0.2861** | **2400 B** | **1.00** | +| MEDI | 100 | 1 | 1,125.26 ns | 432.029 ns | 23.681 ns | 1.09 | 0.03 | 0.2861 | 2400 B | 1.00 | | | | | | | | | | | | | -| **Jab** | **100** | **10** | **1,139.52 ns** | **280.886 ns** | **15.396 ns** | **1.00** | **0.00** | **0.2861** | **2400 B** | **1.00** | -| MEDI | 100 | 10 | 1,152.13 ns | 321.683 ns | 17.633 ns | 1.01 | 0.02 | 0.2861 | 2400 B | 1.00 | +| **Jab** | **100** | **10** | **1,021.71 ns** | **51.090 ns** | **2.800 ns** | **1.00** | **0.00** | **0.2861** | **2400 B** | **1.00** | +| MEDI | 100 | 10 | 1,098.06 ns | 859.324 ns | 47.102 ns | 1.07 | 0.04 | 0.2861 | 2400 B | 1.00 | | | | | | | | | | | | | -| **Jab** | **100** | **100** | **1,190.60 ns** | **103.101 ns** | **5.651 ns** | **1.00** | **0.00** | **0.2861** | **2400 B** | **1.00** | -| MEDI | 100 | 100 | 1,141.38 ns | 229.728 ns | 12.592 ns | 0.96 | 0.02 | 0.2861 | 2400 B | 1.00 | +| **Jab** | **100** | **100** | **1,025.09 ns** | **50.801 ns** | **2.785 ns** | **1.00** | **0.00** | **0.2861** | **2400 B** | **1.00** | +| MEDI | 100 | 100 | 1,090.81 ns | 81.847 ns | 4.486 ns | 1.06 | 0.01 | 0.2861 | 2400 B | 1.00 | diff --git a/doc/benchmark/Jab.Performance.Startup.StartupBenchmark-report-github.md b/doc/benchmark/Jab.Performance.Startup.StartupBenchmark-report-github.md index 86c6055..4cf66da 100644 --- a/doc/benchmark/Jab.Performance.Startup.StartupBenchmark-report-github.md +++ b/doc/benchmark/Jab.Performance.Startup.StartupBenchmark-report-github.md @@ -12,17 +12,17 @@ WarmupCount=3 ``` | Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated | Alloc Ratio | |--------------- |-------------:|--------------:|------------:|-------:|-------:|----------:|------------:| -| Jab_Singleton | 8.541 ns | 3.4715 ns | 0.1903 ns | 0.0067 | - | 56 B | 1.00 | -| MEDI_Singleton | 2,162.589 ns | 2,026.5482 ns | 111.0819 ns | 0.8640 | 0.2155 | 7232 B | ? | +| Jab_Singleton | 8.763 ns | 0.5496 ns | 0.0301 ns | 0.0067 | - | 56 B | 1.00 | +| MEDI_Singleton | 1,883.539 ns | 1,976.8621 ns | 108.3585 ns | 0.8640 | 0.2155 | 7232 B | ? | | | | | | | | | | -| Jab_Scoped | 9.227 ns | 4.8011 ns | 0.2632 ns | 0.0038 | - | 32 B | 1.00 | -| MEDI_Scoped | 1,895.721 ns | 2,150.1331 ns | 117.8560 ns | 0.8640 | 0.2155 | 7232 B | ? | +| Jab_Scoped | 8.445 ns | 6.0425 ns | 0.3312 ns | 0.0038 | - | 32 B | 1.00 | +| MEDI_Scoped | 1,894.341 ns | 1,854.7252 ns | 101.6637 ns | 0.8640 | 0.2155 | 7232 B | ? | | | | | | | | | | -| Jab_Transient | 8.397 ns | 1.7967 ns | 0.0985 ns | 0.0038 | - | 32 B | 1.00 | -| MEDI_Transient | 2,116.654 ns | 4,289.4329 ns | 235.1183 ns | 0.8640 | 0.2155 | 7232 B | ? | +| Jab_Transient | 8.695 ns | 11.2536 ns | 0.6168 ns | 0.0038 | - | 32 B | 1.00 | +| MEDI_Transient | 1,894.840 ns | 2,000.5040 ns | 109.6544 ns | 0.8640 | 0.2155 | 7232 B | ? | | | | | | | | | | -| Jab_Mixed | 9.697 ns | 0.1884 ns | 0.0103 ns | 0.0067 | - | 56 B | 1.00 | -| MEDI_Mixed | 2,519.538 ns | 1,988.6074 ns | 109.0023 ns | 1.0834 | 0.2689 | 9064 B | ? | +| Jab_Mixed | 9.722 ns | 2.2865 ns | 0.1253 ns | 0.0067 | - | 56 B | 1.00 | +| MEDI_Mixed | 2,454.882 ns | 2,626.4526 ns | 143.9647 ns | 1.0834 | 0.2689 | 9064 B | ? | | | | | | | | | | -| Jab_Complex | 13.230 ns | 9.9845 ns | 0.5473 ns | 0.0067 | - | 56 B | 1.00 | -| MEDI_Complex | 2,429.244 ns | 1,541.6226 ns | 84.5015 ns | 1.1330 | 0.2823 | 9496 B | ? | +| Jab_Complex | 13.402 ns | 4.5401 ns | 0.2489 ns | 0.0067 | - | 56 B | 1.00 | +| MEDI_Complex | 2,350.227 ns | 2,335.5694 ns | 128.0204 ns | 1.1330 | 0.2823 | 9496 B | ? |