-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
215 changed files
with
3,145 additions
and
2,531 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/Elders.Cronus.Performance/Elders.Cronus.Performance.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="BenchmarkDotNet" Version="0.13.7" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Elders.Cronus\Elders.Cronus.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using System.Runtime.CompilerServices; | ||
using BenchmarkDotNet.Attributes; | ||
using Microsoft.Extensions.Logging; | ||
|
||
//BenchmarkRunner.Run<LoggingBench>(); | ||
|
||
[MemoryDiagnoser] | ||
public class LoggingBench | ||
{ | ||
private readonly ILogger _logger; | ||
private string _name = "Batman"; | ||
private int _age = 82; | ||
|
||
public LoggingBench() | ||
{ | ||
_logger = LoggerFactory.Create(builder => | ||
{ | ||
builder.ClearProviders(); | ||
builder.AddProvider(new MyLoggerProvider()); | ||
}).CreateLogger(typeof(LoggingBench)); | ||
} | ||
|
||
[Benchmark(Baseline = true)] | ||
public void Default() => Log.Log0(_logger, _name, _age); | ||
|
||
[Benchmark] | ||
public void SkipEnabledCheck() => Log.Log1(_logger, _name, _age); | ||
|
||
private static class Log | ||
{ | ||
static LogDefineOptions logOptions = new LogDefineOptions() | ||
{ | ||
SkipEnabledCheck = true | ||
}; | ||
|
||
private static readonly Action<ILogger, string, int, Exception?> s_log0 = LoggerMessage.Define<string, int>( | ||
LogLevel.Information, | ||
new EventId(1001), | ||
"Name {Name} is {Age} years old"); | ||
|
||
private static readonly Action<ILogger, string, int, Exception?> s_log1 = LoggerMessage.Define<string, int>( | ||
LogLevel.Information, | ||
new EventId(1001), | ||
"Name {Name} is {Age} years old", | ||
logOptions); | ||
|
||
public static void Log0(ILogger logger, string name, int age) => s_log0(logger, name, age, null); | ||
public static void Log1(ILogger logger, string name, int age) => s_log1(logger, name, age, null); | ||
} | ||
} | ||
|
||
public class MyLogger : ILogger | ||
{ | ||
public IDisposable BeginScope<TState>(TState state) => throw new NotImplementedException(); | ||
public bool IsEnabled(LogLevel logLevel) => false; | ||
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter) | ||
=> LogCore(formatter(state, exception)); | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
private static void LogCore(string _) { } | ||
} | ||
|
||
public class MyLoggerProvider : ILoggerProvider | ||
{ | ||
public ILogger CreateLogger(string categoryName) => new MyLogger(); | ||
public void Dispose() { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//using BenchmarkDotNet.Attributes; | ||
//using Elders.Cronus.Performance; | ||
|
||
//LoggingBenchmark lb = new LoggingBenchmark(); | ||
//lb.LogInterpolation(); | ||
|
||
//BenchmarkDotNet.Running.BenchmarkRunner.Run<TestRunner>(); | ||
|
||
//[MemoryDiagnoser] | ||
//public class TestRunner | ||
//{ | ||
// LoggingBenchmark lb = new LoggingBenchmark(); | ||
|
||
// [Benchmark] | ||
// public void LogInterpolation() | ||
// { | ||
|
||
// } | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using BenchmarkDotNet.Attributes; | ||
using BenchmarkDotNet.Running; | ||
using Elders.Cronus; | ||
|
||
BenchmarkRunner.Run<UrnInitBench>(); | ||
|
||
[MemoryDiagnoser] | ||
public class UrnInitBench | ||
{ | ||
string urnString = "urn:elders:user:8eef39fd-b4fa-4323-b062-85e756960862"; | ||
|
||
[Benchmark] | ||
public void Constructor() | ||
{ | ||
var urn = new Urn(urnString); | ||
} | ||
|
||
[Benchmark] | ||
public void Parse() | ||
{ | ||
var urn = new Urn(urnString); | ||
} | ||
} | ||
|
1 change: 0 additions & 1 deletion
1
src/Elders.Cronus.Tests/Discoveries/When_discoving_jobs_from_discoveryContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.