diff --git a/benchmarks/HydraScript.Benchmarks/GeneratedRegexContainer.cs b/benchmarks/HydraScript.Benchmarks/GeneratedRegexContainer.cs
deleted file mode 100644
index 980da6d0..00000000
--- a/benchmarks/HydraScript.Benchmarks/GeneratedRegexContainer.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System.Text.RegularExpressions;
-using HydraScript.Domain.FrontEnd.Lexer;
-using HydraScript.Infrastructure;
-
-namespace HydraScript.Benchmarks;
-
-internal sealed partial class GeneratedRegexContainer : IGeneratedRegexContainer
-{
- [GeneratedRegex(PatternContainer.Value, RegexOptions.Compiled)]
- public static partial Regex Regex { get; }
-}
\ No newline at end of file
diff --git a/benchmarks/HydraScript.Benchmarks/HydraScript.Benchmarks.csproj b/benchmarks/HydraScript.Benchmarks/HydraScript.Benchmarks.csproj
index 670f013f..443c4628 100644
--- a/benchmarks/HydraScript.Benchmarks/HydraScript.Benchmarks.csproj
+++ b/benchmarks/HydraScript.Benchmarks/HydraScript.Benchmarks.csproj
@@ -5,12 +5,6 @@
-
-
diff --git a/benchmarks/HydraScript.Benchmarks/InvokeBenchmark.cs b/benchmarks/HydraScript.Benchmarks/InvokeBenchmark.cs
index 4f920553..f20d8c6f 100644
--- a/benchmarks/HydraScript.Benchmarks/InvokeBenchmark.cs
+++ b/benchmarks/HydraScript.Benchmarks/InvokeBenchmark.cs
@@ -15,19 +15,23 @@ public class InvokeBenchmark
{
private ServiceProvider? _provider;
private Executor? _executor;
- private readonly UpdatableFileOptions _updatableFileOptions = new(new FileInfo(nameof(FileInfo)));
- private readonly IReadOnlyList _scriptPaths =
+ private readonly UpdatableFileOptions _updatableFileOptions = new(new FileInfo(nameof(FileInfo)));
+ private readonly FileInfo[] _scriptPaths =
Directory.GetFiles("Samples")
.Select(x => new FileInfo(x))
.ToArray();
+ private readonly int _benchmarkSize;
+
+ public InvokeBenchmark() => _benchmarkSize = _scriptPaths.Length / 3;
+
[GlobalSetup]
public void GlobalSetup()
{
_provider = new ServiceCollection()
.AddLogging(x => x.ClearProviders().AddProvider(NullLoggerProvider.Instance))
- .AddDomain()
+ .AddDomain()
.AddApplication()
.AddInfrastructure(dump: false, _updatableFileOptions.Value)
.AddSingleton>(_updatableFileOptions)
@@ -35,13 +39,16 @@ public void GlobalSetup()
_executor = _provider.GetRequiredService();
}
+ [IterationSetup]
+ public void IterationSetup() => Random.Shared.Shuffle(_scriptPaths);
+
[GlobalCleanup]
public void GlobalCleanup() => _provider?.Dispose();
[Benchmark]
public void Invoke()
{
- for (var i = 0; i < _scriptPaths.Count; i++)
+ for (var i = 0; i <_benchmarkSize; i++)
{
_updatableFileOptions.Update(_scriptPaths[i]);
_executor?.Invoke();
diff --git a/src/HydraScript/HydraScript.csproj b/src/HydraScript/HydraScript.csproj
index 9ff91a96..d3044eda 100644
--- a/src/HydraScript/HydraScript.csproj
+++ b/src/HydraScript/HydraScript.csproj
@@ -7,10 +7,6 @@
-
diff --git a/src/HydraScript/Program.cs b/src/HydraScript/Program.cs
index f5841b52..35d7409d 100644
--- a/src/HydraScript/Program.cs
+++ b/src/HydraScript/Program.cs
@@ -28,7 +28,7 @@ private static ExecuteCommand GetCommand()
private static ServiceProvider GetServiceProvider(FileInfo fileInfo, bool dump) =>
new ServiceCollection()
.AddLogging(c => c.ClearProviders().AddZLoggerConsole())
- .AddDomain()
+ .AddDomain()
.AddApplication()
.AddInfrastructure(dump, fileInfo)
.BuildServiceProvider();
diff --git a/src/Infrastructure/HydraScript.Infrastructure.LexerRegexGenerator/HydraScript.Infrastructure.LexerRegexGenerator.csproj b/src/Infrastructure/HydraScript.Infrastructure.LexerRegexGenerator/HydraScript.Infrastructure.LexerRegexGenerator.csproj
index acd99492..46dcae73 100644
--- a/src/Infrastructure/HydraScript.Infrastructure.LexerRegexGenerator/HydraScript.Infrastructure.LexerRegexGenerator.csproj
+++ b/src/Infrastructure/HydraScript.Infrastructure.LexerRegexGenerator/HydraScript.Infrastructure.LexerRegexGenerator.csproj
@@ -11,11 +11,11 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
-
+
diff --git a/src/HydraScript/GeneratedRegexContainer.cs b/src/Infrastructure/HydraScript.Infrastructure/GeneratedRegexContainer.cs
similarity index 82%
rename from src/HydraScript/GeneratedRegexContainer.cs
rename to src/Infrastructure/HydraScript.Infrastructure/GeneratedRegexContainer.cs
index 380937c6..0446b5e7 100644
--- a/src/HydraScript/GeneratedRegexContainer.cs
+++ b/src/Infrastructure/HydraScript.Infrastructure/GeneratedRegexContainer.cs
@@ -1,8 +1,7 @@
using System.Text.RegularExpressions;
using HydraScript.Domain.FrontEnd.Lexer;
-using HydraScript.Infrastructure;
-namespace HydraScript;
+namespace HydraScript.Infrastructure;
public sealed partial class GeneratedRegexContainer : IGeneratedRegexContainer
{
diff --git a/src/Infrastructure/HydraScript.Infrastructure/HydraScript.Infrastructure.csproj b/src/Infrastructure/HydraScript.Infrastructure/HydraScript.Infrastructure.csproj
index 35d96241..0e7bbf05 100644
--- a/src/Infrastructure/HydraScript.Infrastructure/HydraScript.Infrastructure.csproj
+++ b/src/Infrastructure/HydraScript.Infrastructure/HydraScript.Infrastructure.csproj
@@ -1,6 +1,10 @@
+
diff --git a/src/Infrastructure/HydraScript.Infrastructure/ServiceCollectionExtensions.cs b/src/Infrastructure/HydraScript.Infrastructure/ServiceCollectionExtensions.cs
index 78c93256..1f2c7501 100644
--- a/src/Infrastructure/HydraScript.Infrastructure/ServiceCollectionExtensions.cs
+++ b/src/Infrastructure/HydraScript.Infrastructure/ServiceCollectionExtensions.cs
@@ -15,12 +15,11 @@ namespace HydraScript.Infrastructure;
public static class ServiceCollectionExtensions
{
- public static IServiceCollection AddDomain(this IServiceCollection services)
- where TGeneratedRegexContainer : class, IGeneratedRegexContainer
+ public static IServiceCollection AddDomain(this IServiceCollection services)
{
services.AddSingleton();
services.AddSingleton();
- services.AddSingleton>();
+ services.AddSingleton>();
services.AddSingleton();
services.AddSingleton();
diff --git a/tests/HydraScript.IntegrationTests/TestHostFixture.cs b/tests/HydraScript.IntegrationTests/TestHostFixture.cs
index b2fbbf4f..9f9d644b 100644
--- a/tests/HydraScript.IntegrationTests/TestHostFixture.cs
+++ b/tests/HydraScript.IntegrationTests/TestHostFixture.cs
@@ -36,7 +36,7 @@ public void Dispose()
public Runner GetRunner(Options options, Action? configureTestServices = null)
{
var services = new ServiceCollection()
- .AddDomain()
+ .AddDomain()
.AddApplication()
.AddInfrastructure(options.Dump, new FileInfo(options.FileName));
const string serilogTemplate = "[{Timestamp:HH:mm:ss} {Level:u} [{SourceContext}]]{NewLine}{Message:lj} {Exception}";
diff --git a/tests/HydraScript.UnitTests/Domain/FrontEnd/RegexLexerTests.cs b/tests/HydraScript.UnitTests/Domain/FrontEnd/RegexLexerTests.cs
index bcbe7767..e3e6ba59 100644
--- a/tests/HydraScript.UnitTests/Domain/FrontEnd/RegexLexerTests.cs
+++ b/tests/HydraScript.UnitTests/Domain/FrontEnd/RegexLexerTests.cs
@@ -3,6 +3,7 @@
using HydraScript.Domain.FrontEnd.Lexer;
using HydraScript.Domain.FrontEnd.Lexer.Impl;
using HydraScript.Domain.FrontEnd.Lexer.TokenTypes;
+using HydraScript.Infrastructure;
namespace HydraScript.UnitTests.Domain.FrontEnd;
diff --git a/tests/HydraScript.UnitTests/Domain/FrontEnd/StructureTests.cs b/tests/HydraScript.UnitTests/Domain/FrontEnd/StructureTests.cs
index c3e1314f..c8e681a3 100644
--- a/tests/HydraScript.UnitTests/Domain/FrontEnd/StructureTests.cs
+++ b/tests/HydraScript.UnitTests/Domain/FrontEnd/StructureTests.cs
@@ -2,6 +2,7 @@
using HydraScript.Domain.FrontEnd.Lexer;
using HydraScript.Domain.FrontEnd.Lexer.Impl;
using HydraScript.Domain.FrontEnd.Lexer.TokenTypes;
+using HydraScript.Infrastructure;
namespace HydraScript.UnitTests.Domain.FrontEnd;
diff --git a/tests/HydraScript.UnitTests/Domain/FrontEnd/TopDownParserTests.cs b/tests/HydraScript.UnitTests/Domain/FrontEnd/TopDownParserTests.cs
index 66fc7972..9016b3b6 100644
--- a/tests/HydraScript.UnitTests/Domain/FrontEnd/TopDownParserTests.cs
+++ b/tests/HydraScript.UnitTests/Domain/FrontEnd/TopDownParserTests.cs
@@ -1,6 +1,7 @@
using HydraScript.Domain.FrontEnd.Lexer.Impl;
using HydraScript.Domain.FrontEnd.Parser;
using HydraScript.Domain.FrontEnd.Parser.Impl;
+using HydraScript.Infrastructure;
namespace HydraScript.UnitTests.Domain.FrontEnd;