Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayPianikov committed May 15, 2024
1 parent f63670c commit 1cdd2b9
Show file tree
Hide file tree
Showing 65 changed files with 450 additions and 442 deletions.
3 changes: 1 addition & 2 deletions build/ReadmeTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,8 @@ private static async Task AddExample(string logsDirectory, string exampleSearchP
.Replace("Pure.DI.", "")
.Replace(" Benchmarks.Model.", "")
.Replace(salt, "")
.Replace("(MethodImplOptions)0x100", "MethodImplOptions.AggressiveInlining")
.Replace("(MethodImplOptions)256", "MethodImplOptions.AggressiveInlining")
.Replace("(MethodImplOptions)0x8", "MethodImplOptions.NoInlining")));
.Replace("(MethodImplOptions)8", "MethodImplOptions.NoInlining")));
await examplesWriter.WriteLineAsync(generatedCode);
await examplesWriter.WriteLineAsync("```");
}
Expand Down
6 changes: 3 additions & 3 deletions readme/EnumDetails.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ partial class Enum
public partialCompositionRoot TestPureDIByCR()
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
IEnumerable<Benchmarks.Model.IService3> EnumerationOf_perBlock10_IEnumerable()
IEnumerable<Benchmarks.Model.IService3> EnumerationOf_perBlockIEnumerable10()
{
yield return newService3(newService4(), newService4());
yield return newService3v2(newService4(), newService4());
yield return newService3v3(newService4(), newService4());
yield return newService3v4(newService4(), newService4());
}
IEnumerable<Benchmarks.Model.IService3> perBlock10_IEnumerable = EnumerationOf_perBlock10_IEnumerable();
return newCompositionRoot(newService1(newService2Enum(perBlock10_IEnumerable)), newService2Enum(perBlock10_IEnumerable), newService2Enum(perBlock10_IEnumerable), newService2Enum(perBlock10_IEnumerable), newService3(newService4(), newService4()), newService4(), newService4());
IEnumerable<Benchmarks.Model.IService3> perBlockIEnumerable10 = EnumerationOf_perBlockIEnumerable10();
return newCompositionRoot(newService1(newService2Enum(perBlockIEnumerable10)), newService2Enum(perBlockIEnumerable10), newService2Enum(perBlockIEnumerable10), newService2Enum(perBlockIEnumerable10), newService3(newService4(), newService4()), newService4(), newService4());
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down
8 changes: 4 additions & 4 deletions readme/FuncDetails.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ partial class Func
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public partialCompositionRoot TestPureDIByCR()
{
Func<Benchmarks.Model.IService3> perBlock10_Func = new Func<Benchmarks.Model.IService3>(
Func<Benchmarks.Model.IService3> perBlockFunc10 = new Func<Benchmarks.Model.IService3>(
[MethodImpl(MethodImplOptions.AggressiveInlining)]
() =>
{
var value_0 = newService3(newService4(), newService4());
return value_0;
var localValue0 = newService3(newService4(), newService4());
return localValue0;
});
return newCompositionRoot(newService1(newService2Func(perBlock10_Func)), newService2Func(perBlock10_Func), newService2Func(perBlock10_Func), newService2Func(perBlock10_Func), newService3(newService4(), newService4()), newService4(), newService4());
return newCompositionRoot(newService1(newService2Func(perBlockFunc10)), newService2Func(perBlockFunc10), newService2Func(perBlockFunc10), newService2Func(perBlockFunc10), newService3(newService4(), newService4()), newService4(), newService4());
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down
14 changes: 7 additions & 7 deletions readme/SingletonDetails.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ The following partial class will be generated:
partial class Singleton
{
private readonly Singleton _root;
privateService1? _scoped37_Service1;
privateService4? _scoped40_Service4;
privateService1? _scopedService137;
privateService4? _scopedService440;

public Singleton()
{
Expand All @@ -78,15 +78,15 @@ partial class Singleton
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public partialCompositionRoot TestPureDIByCR()
{
if (_scoped40_Service4 == null)
if (_scopedService440 == null)
{
_scoped40_Service4 = newService4();
_scopedService440 = newService4();
}
if (_scoped37_Service1 == null)
if (_scopedService137 == null)
{
_scoped37_Service1 = newService1(newService2(newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!)));
_scopedService137 = newService1(newService2(newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!)));
}
return newCompositionRoot(_scoped37_Service1!, newService2(newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!)), newService2(newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!)), newService2(newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!)), newService3(_scoped40_Service4!, _scoped40_Service4!), _scoped40_Service4!, _scoped40_Service4!);
return newCompositionRoot(_scopedService137!, newService2(newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!)), newService2(newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!)), newService2(newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!)), newService3(_scopedService440!, _scopedService440!), _scopedService440!, _scopedService440!);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down
26 changes: 13 additions & 13 deletions readme/accumulators.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ partial class Composition
{
private readonly Composition _root;
private readonly object _lock;
private XyzDependency? _singleton38_XyzDependency;
private XyzDependency? _singletonXyzDependency38;

public Composition()
{
Expand All @@ -68,32 +68,32 @@ partial class Composition
get
{
var accumulator42 = new MyAccumulator();
AbcDependency perBlock4_AbcDependency = new AbcDependency();
if (_root._singleton38_XyzDependency == null)
AbcDependency perBlockAbcDependency4 = new AbcDependency();
if (_root._singletonXyzDependency38 == null)
{
lock (_lock)
{
if (_root._singleton38_XyzDependency == null)
if (_root._singletonXyzDependency38 == null)
{
XyzDependency _singleton38_XyzDependencyTemp;
_singleton38_XyzDependencyTemp = new XyzDependency();
accumulator42.Add(_singleton38_XyzDependencyTemp);
XyzDependency _singletonXyzDependency38Temp;
_singletonXyzDependency38Temp = new XyzDependency();
accumulator42.Add(_singletonXyzDependency38Temp);
Thread.MemoryBarrier();
_root._singleton38_XyzDependency = _singleton38_XyzDependencyTemp;
_root._singletonXyzDependency38 = _singletonXyzDependency38Temp;
}
}
}
AbcDependency transient3_AbcDependency = new AbcDependency();
AbcDependency transientAbcDependency3 = new AbcDependency();
lock (_lock)
{
accumulator42.Add(transient3_AbcDependency);
accumulator42.Add(transientAbcDependency3);
}
Service transient1_Service = new Service(transient3_AbcDependency, _root._singleton38_XyzDependency!, perBlock4_AbcDependency);
Service transientService1 = new Service(transientAbcDependency3, _root._singletonXyzDependency38!, perBlockAbcDependency4);
lock (_lock)
{
accumulator42.Add(transient1_Service);
accumulator42.Add(transientService1);
}
return (transient1_Service, accumulator42);
return (transientService1, accumulator42);
}
}

Expand Down
28 changes: 14 additions & 14 deletions readme/async-disposable-scope.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ partial class Composition: IDisposable, IAsyncDisposable
private readonly object _lock;
private object[] _disposables;
private int _disposeIndex;
private Dependency? _scoped36_Dependency;
private Dependency? _scopedDependency36;

public Composition()
{
Expand All @@ -112,18 +112,18 @@ partial class Composition: IDisposable, IAsyncDisposable
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
if (_scoped36_Dependency == null)
if (_scopedDependency36 == null)
{
lock (_lock)
{
if (_scoped36_Dependency == null)
if (_scopedDependency36 == null)
{
_scoped36_Dependency = new Dependency();
_disposables[_disposeIndex++] = _scoped36_Dependency;
_scopedDependency36 = new Dependency();
_disposables[_disposeIndex++] = _scopedDependency36;
}
}
}
return new Service(_scoped36_Dependency!);
return new Service(_scopedDependency36!);
}
}

Expand All @@ -132,16 +132,16 @@ partial class Composition: IDisposable, IAsyncDisposable
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
var perResolve43_Func = default(Func<Session>);
perResolve43_Func = new Func<Session>(
var perResolveFunc43 = default(Func<Session>);
perResolveFunc43 = new Func<Session>(
[MethodImpl(MethodImplOptions.AggressiveInlining)]
() =>
{
Composition transient2_Composition = this;
var value_0 = new Session(transient2_Composition);
return value_0;
Composition transientComposition2 = this;
var localValue0 = new Session(transientComposition2);
return localValue0;
});
return new Program(perResolve43_Func!);
return new Program(perResolveFunc43!);
}
}

Expand All @@ -155,7 +155,7 @@ partial class Composition: IDisposable, IAsyncDisposable
_disposeIndex = 0;
disposables = _disposables;
_disposables = new object[1];
_scoped36_Dependency = null;
_scopedDependency36 = null;
}

while (disposeIndex-- > 0)
Expand Down Expand Up @@ -192,7 +192,7 @@ partial class Composition: IDisposable, IAsyncDisposable
_disposeIndex = 0;
disposables = _disposables;
_disposables = new object[1];
_scoped36_Dependency = null;
_scopedDependency36 = null;
}

while (disposeIndex-- > 0)
Expand Down
16 changes: 8 additions & 8 deletions readme/async-disposable-singleton.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ partial class Composition: IDisposable, IAsyncDisposable
private readonly object _lock;
private object[] _disposables;
private int _disposeIndex;
private Dependency? _singleton36_Dependency;
private Dependency? _singletonDependency36;

public Composition()
{
Expand All @@ -78,18 +78,18 @@ partial class Composition: IDisposable, IAsyncDisposable
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
if (_root._singleton36_Dependency == null)
if (_root._singletonDependency36 == null)
{
lock (_lock)
{
if (_root._singleton36_Dependency == null)
if (_root._singletonDependency36 == null)
{
_root._singleton36_Dependency = new Dependency();
_root._disposables[_root._disposeIndex++] = _root._singleton36_Dependency;
_root._singletonDependency36 = new Dependency();
_root._disposables[_root._disposeIndex++] = _root._singletonDependency36;
}
}
}
return new Service(_root._singleton36_Dependency!);
return new Service(_root._singletonDependency36!);
}
}

Expand All @@ -103,7 +103,7 @@ partial class Composition: IDisposable, IAsyncDisposable
_disposeIndex = 0;
disposables = _disposables;
_disposables = new object[1];
_singleton36_Dependency = null;
_singletonDependency36 = null;
}

while (disposeIndex-- > 0)
Expand Down Expand Up @@ -140,7 +140,7 @@ partial class Composition: IDisposable, IAsyncDisposable
_disposeIndex = 0;
disposables = _disposables;
_disposables = new object[1];
_singleton36_Dependency = null;
_singletonDependency36 = null;
}

while (disposeIndex-- > 0)
Expand Down
6 changes: 3 additions & 3 deletions readme/async-enumerable.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ partial class Composition
get
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
async IAsyncEnumerable<IDependency> EnumerationOf_transient1_IAsyncEnumerable()
async IAsyncEnumerable<IDependency> EnumerationOf_transientIAsyncEnumerable1()
{
yield return new AbcDependency();
yield return new XyzDependency();
await Task.CompletedTask;
}
IAsyncEnumerable<IDependency> transient1_IAsyncEnumerable = EnumerationOf_transient1_IAsyncEnumerable();
return new Service(transient1_IAsyncEnumerable);
IAsyncEnumerable<IDependency> transientIAsyncEnumerable1 = EnumerationOf_transientIAsyncEnumerable1();
return new Service(transientIAsyncEnumerable1);
}
}

Expand Down
30 changes: 15 additions & 15 deletions readme/auto-scoped.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ partial class Composition
{
private readonly Composition _root;
private readonly object _lock;
private Dependency? _scoped36_Dependency;
private Dependency? _scopedDependency36;

public Composition()
{
Expand All @@ -90,17 +90,17 @@ partial class Composition
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
if (_scoped36_Dependency == null)
if (_scopedDependency36 == null)
{
lock (_lock)
{
if (_scoped36_Dependency == null)
if (_scopedDependency36 == null)
{
_scoped36_Dependency = new Dependency();
_scopedDependency36 = new Dependency();
}
}
}
return new Service(_scoped36_Dependency!);
return new Service(_scopedDependency36!);
}
}

Expand All @@ -109,23 +109,23 @@ partial class Composition
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
var perResolve43_Func = default(Func<IService>);
perResolve43_Func = new Func<IService>(
var perResolveFunc43 = default(Func<IService>);
perResolveFunc43 = new Func<IService>(
[MethodImpl(MethodImplOptions.AggressiveInlining)]
() =>
{
Composition transient2_Composition = this;
IService transient1_IService;
Composition transientComposition2 = this;
IService transientIService1;
{
var baseComposition_1 = transient2_Composition;
var localBaseComposition1 = transientComposition2;
// Creates a session
var session_2 = new Composition(baseComposition_1);
transient1_IService = session_2.SessionRoot;
var localSession2 = new Composition(localBaseComposition1);
transientIService1 = localSession2.SessionRoot;
}
var value_0 = transient1_IService;
return value_0;
var localValue0 = transientIService1;
return localValue0;
});
return new Program(perResolve43_Func!);
return new Program(perResolveFunc43!);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions readme/check-for-a-root.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ partial class Composition
}
}

private IDependency Root0001
private IDependency Root1
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
Expand Down Expand Up @@ -168,7 +168,7 @@ partial class Composition
OnNewRoot<IService, Service>(valResolver_0000, "Root", null, Lifetime.Transient);
Resolver<IService>.Value = valResolver_0000;
var valResolver_0001 = new Resolver_0001();
OnNewRoot<IDependency, Dependency>(valResolver_0001, "Root0001", "MyDep", Lifetime.Transient);
OnNewRoot<IDependency, Dependency>(valResolver_0001, "Root1", "MyDep", Lifetime.Transient);
Resolver<IDependency>.Value = valResolver_0001;
_buckets = Buckets<Type, IResolver<Composition, object>>.Create(
4,
Expand Down Expand Up @@ -230,7 +230,7 @@ partial class Composition
switch (tag)
{
case "MyDep":
return composition.Root0001;
return composition.Root1;

default:
return base.ResolveByTag(composition, tag);
Expand Down
Loading

0 comments on commit 1cdd2b9

Please sign in to comment.