Skip to content

Commit 9c016ad

Browse files
authored
Merge pull request #63 from futurum-dev/feature/performance
Performance - improvements
2 parents ab99125 + 25de016 commit 9c016ad

File tree

35 files changed

+540
-265
lines changed

35 files changed

+540
-265
lines changed

benchmark/Futurum.WebApiEndpoint.Benchmark.MinimalApi/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"launchUrl": "swagger",
99
"applicationUrl": "https://localhost:7256;http://localhost:5279",
1010
"environmentVariables": {
11-
"ASPNETCORE_ENVIRONMENT": "Development"
11+
"ASPNETCORE_ENVIRONMENT": "Production"
1212
}
1313
}
1414
}

benchmark/Futurum.WebApiEndpoint.Benchmark.MvcController/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"launchUrl": "swagger",
99
"applicationUrl": "https://localhost:7290;http://localhost:5020",
1010
"environmentVariables": {
11-
"ASPNETCORE_ENVIRONMENT": "Development"
11+
"ASPNETCORE_ENVIRONMENT": "Production"
1212
}
1313
}
1414
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "https://json.schemastore.org/launchsettings.json",
3+
"profiles": {
4+
"Futurum.WebApiEndpoint.Benchmark.Runner": {
5+
"commandName": "Project",
6+
"dotnetRunMessages": true,
7+
"environmentVariables": {
8+
"ASPNETCORE_ENVIRONMENT": "Production"
9+
}
10+
}
11+
}
12+
}

benchmark/Futurum.WebApiEndpoint.Benchmark.WebApiEndpoint.TestRunner/App.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public App(IHttpClientFactory httpClientFactory)
2222

2323
public Task<Result> ExecuteAsync()
2424
{
25-
return Enumerable.Range(0, 1000000)
25+
return Enumerable.Range(0, 1)
2626
.FlatMapAsync(async i =>
2727
{
2828
using (var httpClient = _httpClientFactory.CreateClient())

benchmark/Futurum.WebApiEndpoint.Benchmark.WebApiEndpoint.TestRunner/Futurum.WebApiEndpoint.Benchmark.WebApiEndpoint.TestRunner.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="Futurum.Core" Version="1.0.8" />
20+
<PackageReference Include="Futurum.Core" Version="1.0.10" />
2121
</ItemGroup>
2222

2323
<ItemGroup>

benchmark/Futurum.WebApiEndpoint.Benchmark.WebApiEndpoint/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
namespace Futurum.WebApiEndpoint.Benchmark.WebApiEndpoint
4242
{
43-
public partial class Program
43+
public class Program
4444
{
4545
}
4646
}

benchmark/Futurum.WebApiEndpoint.Benchmark.WebApiEndpoint/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"launchUrl": "swagger",
99
"applicationUrl": "https://localhost:7096;http://localhost:5010",
1010
"environmentVariables": {
11-
"ASPNETCORE_ENVIRONMENT": "Development"
11+
"ASPNETCORE_ENVIRONMENT": "Production"
1212
}
1313
}
1414
}

benchmark/Futurum.WebApiEndpoint.Benchmark.WebApiEndpoint/TestWebApiEndpoint.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public record Response(int Id, string Name, int Age, string PhoneNumber);
2222

2323
public class ApiEndpoint : CommandWebApiEndpoint.Request<RequestDto, Query>.Response<ResponseDto, Response>.Mapper<Mapper>
2424
{
25-
public override Task<Result<Response>> ExecuteAsync(Query request, CancellationToken cancellationToken) =>
26-
new Response(request.Id, request.FirstName + " " + request.LastName, request.Age, request.PhoneNumbers?.FirstOrDefault()).ToResultOkAsync();
25+
public override async Task<Result<Response>> ExecuteAsync(Query request, CancellationToken cancellationToken) =>
26+
new Response(request.Id, request.FirstName + " " + request.LastName, request.Age, request.PhoneNumbers?.FirstOrDefault()).ToResultOk();
2727
}
2828

2929
public class Mapper : IWebApiEndpointRequestMapper<RequestDto, Query>, IWebApiEndpointResponseDtoMapper<Response, ResponseDto>

sample/Futurum.WebApiEndpoint.Sample/Features/QueryWithRequestManualParameter/QueryWithRequestManualParameterWithResponseBytesRangeScenario.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public override Task<Result<ResponseBytes>> ExecuteAsync(Request request, Cancel
2323
public class Mapper : IWebApiEndpointRequestMapper<Request>
2424
{
2525
public Task<Result<Request>> MapAsync(HttpContext httpContext, MetadataDefinition metadataDefinition, CancellationToken cancellationToken) =>
26-
RangeHeaderMapper.Map(httpContext).ToResult(() => "Unable to get range")
26+
RangeHeaderMapper.Map(httpContext).ToResult("Unable to get range")
2727
.Then(range => httpContext.GetRequestPathParameterAsString("Content")
2828
.Map(content => new Request(content, range)))
2929
.ToResultAsync();

sample/Futurum.WebApiEndpoint.Sample/Futurum.WebApiEndpoint.Sample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="Futurum.ApiEndpoint" Version="1.0.0" />
15-
<PackageReference Include="Futurum.Core" Version="1.0.8" />
15+
<PackageReference Include="Futurum.Core" Version="1.0.10" />
1616
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
1717
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
1818
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />

0 commit comments

Comments
 (0)