Skip to content

Commit f8efc38

Browse files
committed
Merge branch 'master' of github.com:TechEmpower/FrameworkBenchmarks
2 parents 17c3d6e + 5e14b91 commit f8efc38

File tree

221 files changed

+3658
-1841
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+3658
-1841
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ jobs:
155155
# run-ci.py runs the diffing to see if github actions needs to test this framework. Ideally/eventually,
156156
# we'd like to try and do the diffing before github_actions_clean & setup.
157157
# This will run the tests exactly as you would in your own vm:
158-
docker network create tfb > /dev/null 2>&1 && docker run --network=tfb -e USER_ID=$(id -u) -e CI=true -v /var/run/docker.sock:/var/run/docker.sock --mount type=bind,source=`pwd`,target=/FrameworkBenchmarks techempower/tfb --mode verify --test-dir $RUN_TESTS --results-environment Github-Actions;
158+
docker network create tfb > /dev/null 2>&1 && docker run --network=tfb -e USER_ID=$(id -u) -e CI=true -v /var/run/docker.sock:/var/run/docker.sock --mount type=bind,source=`pwd`,target=/FrameworkBenchmarks techempower/tfb --mode verify --force-rm --test-dir $RUN_TESTS --results-environment Github-Actions;
159159
dependabot:
160160
needs: verify
161161
runs-on: ubuntu-latest

frameworks/CSharp/genhttp/Benchmarks/Benchmarks.csproj

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
<PropertyGroup>
44

5-
<TargetFramework>net9.0</TargetFramework>
6-
<LangVersion>13.0</LangVersion>
5+
<TargetFramework>net10.0</TargetFramework>
6+
<LangVersion>14.0</LangVersion>
77
<ImplicitUsings>true</ImplicitUsings>
88
<OutputType>Exe</OutputType>
99

1010
<AssemblyTitle>GenHTTP Benchmarks</AssemblyTitle>
1111
<Description>Test suite to be executed with TechEmpower FrameworkBenchmarks.</Description>
1212

13+
<DefineConstants>$(DefineConstants);$(GENHTTP_ENGINE_NAME)</DefineConstants>
14+
1315
<ServerGarbageCollection>true</ServerGarbageCollection>
1416
<TieredPGO>true</TieredPGO>
1517

@@ -26,11 +28,12 @@
2628

2729
<ItemGroup>
2830

29-
<PackageReference Include="GenHTTP.Core" Version="9.8.0" />
30-
<PackageReference Include="GenHTTP.Modules.Webservices" Version="9.8.0" />
31+
<PackageReference Include="$(GENHTTP_ENGINE_PACKAGE)" Version="10.1.0" />
32+
33+
<PackageReference Include="GenHTTP.Modules.Webservices" Version="10.1.0" />
3134

32-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.10" />
33-
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
35+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.0" />
36+
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0" />
3437

3538
</ItemGroup>
3639

frameworks/CSharp/genhttp/Benchmarks/Program.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
using Benchmarks.Tests;
22
using Benchmarks.Utilities;
33

4+
#if INTERNAL
45
using GenHTTP.Engine.Internal;
6+
#else
7+
using GenHTTP.Engine.Kestrel;
8+
#endif
59

610
using GenHTTP.Modules.IO;
711
using GenHTTP.Modules.Layouting;

frameworks/CSharp/genhttp/Benchmarks/Tests/JsonHandler.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
using System.Text.Json;
1+
using Benchmarks.Utilities;
22

33
using GenHTTP.Api.Content;
44
using GenHTTP.Api.Protocol;
55

6-
using GenHTTP.Modules.Conversion.Serializers.Json;
7-
86
namespace Benchmarks.Tests;
97

108
public sealed class JsonResult
@@ -15,9 +13,7 @@ public sealed class JsonResult
1513

1614
public sealed class JsonHandler : IHandler
1715
{
18-
private static readonly FlexibleContentType _ContentType = new(ContentType.ApplicationJson, "utf-8");
19-
20-
private static readonly JsonSerializerOptions _Options = new();
16+
private static readonly FlexibleContentType ContentType = new(GenHTTP.Api.Protocol.ContentType.ApplicationJson, "utf-8");
2117

2218
public ValueTask PrepareAsync() => new();
2319

@@ -29,8 +25,8 @@ public ValueTask<IResponse> HandleAsync(IRequest request)
2925
};
3026

3127
var response = request.Respond()
32-
.Content(new JsonContent(result, _Options))
33-
.Type(_ContentType)
28+
.Content(new FixedLengthJsonContent(result))
29+
.Type(ContentType)
3430
.Build();
3531

3632
return new(response);
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System.Text.Json;
2+
3+
using GenHTTP.Api.Protocol;
4+
5+
using Benchmarks.Tests;
6+
7+
namespace Benchmarks.Utilities;
8+
9+
public sealed class FixedLengthJsonContent : IResponseContent
10+
{
11+
private readonly MemoryStream _buffer = new();
12+
13+
public ulong? Length => (ulong)_buffer.Length;
14+
15+
public FixedLengthJsonContent(JsonResult result)
16+
{
17+
JsonSerializer.SerializeAsync(_buffer, result);
18+
}
19+
20+
public ValueTask<ulong?> CalculateChecksumAsync() => throw new NotImplementedException();
21+
22+
public ValueTask WriteAsync(Stream target, uint bufferSize)
23+
{
24+
_buffer.Seek(0, SeekOrigin.Begin);
25+
26+
_buffer.CopyTo(target);
27+
28+
return ValueTask.CompletedTask;
29+
}
30+
31+
}

frameworks/CSharp/genhttp/benchmark_config.json

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"framework": "genhttp",
2+
"framework": "genhttp",
3+
"maintainers": ["Kaliumhexacyanoferrat"],
34
"tests": [{
45
"default": {
56
"plaintext_url": "/plaintext",
@@ -17,11 +18,33 @@
1718
"language": "C#",
1819
"orm": "Raw",
1920
"platform": ".NET",
20-
"webserver": "Kestrel",
21+
"webserver": "GenHTTP",
2122
"os": "Linux",
2223
"database_os": "Linux",
23-
"display_name": "GenHTTP",
24+
"display_name": "genhttp [internal]",
2425
"notes": ""
26+
},
27+
"kestrel": {
28+
"plaintext_url": "/plaintext",
29+
"json_url": "/json",
30+
"db_url": "/db",
31+
"query_url": "/queries/",
32+
"update_url": "/updates/",
33+
"fortune_url": "/fortunes",
34+
"cached_query_url": "/cached-worlds/",
35+
"port": 8080,
36+
"approach": "Realistic",
37+
"classification": "Fullstack",
38+
"database": "Postgres",
39+
"framework": "GenHTTP",
40+
"language": "C#",
41+
"orm": "Raw",
42+
"platform": ".NET",
43+
"webserver": "Kestrel",
44+
"os": "Linux",
45+
"database_os": "Linux",
46+
"display_name": "genhttp [kestrel]",
47+
"notes": ""
2548
}
2649
}]
2750
}

frameworks/CSharp/genhttp/config.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,23 @@ database_os = "Linux"
1616
os = "Linux"
1717
orm = "Raw"
1818
platform = ".NET"
19+
webserver = "GenHTTP"
20+
versus = "None"
21+
22+
[kestrel]
23+
urls.plaintext = "/plaintext"
24+
urls.json = "/json"
25+
urls.db = "/db"
26+
urls.query = "/queries/"
27+
urls.update = "/updates/"
28+
urls.fortune = "/fortunes"
29+
urls.cached_query = "/cached-worlds/"
30+
approach = "Realistic"
31+
classification = "Fullstack"
32+
database = "Postgres"
33+
database_os = "Linux"
34+
os = "Linux"
35+
orm = "Raw"
36+
platform = ".NET"
1937
webserver = "Kestrel"
2038
versus = "None"
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:10.0-alpine AS build
2+
WORKDIR /source
3+
4+
ENV GENHTTP_ENGINE_NAME=KESTREL
5+
ENV GENHTTP_ENGINE_PACKAGE=GenHTTP.Core.Kestrel
6+
7+
# copy csproj and restore as distinct layers
8+
COPY Benchmarks/*.csproj .
9+
RUN dotnet restore -r linux-musl-x64
10+
11+
# copy and publish app and libraries
12+
COPY Benchmarks/ .
13+
RUN dotnet publish -c release -o /app -r linux-musl-x64 --no-restore --self-contained
14+
15+
# final stage/image
16+
FROM mcr.microsoft.com/dotnet/runtime-deps:10.0-alpine
17+
18+
ENV DOTNET_GCDynamicAdaptationMode=0 \
19+
DOTNET_EnableDiagnostics=0 \
20+
COMPlus_EnableDiagnostics=0 \
21+
COMPlus_DbgEnableMiniDump=0 \
22+
COMPlus_DbgEnableMiniDumpCollection=0 \
23+
COMPlus_DbgMiniDumpType=0 \
24+
DOTNET_TieredPGO=0 \
25+
DOTNET_TC_QuickJitForLoops=1 \
26+
DOTNET_TC_QuickJit=1
27+
28+
WORKDIR /app
29+
COPY --from=build /app .
30+
31+
ENTRYPOINT ["./Benchmarks"]
32+
33+
EXPOSE 8080

frameworks/CSharp/genhttp/genhttp.dockerfile

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
1+
FROM mcr.microsoft.com/dotnet/sdk:10.0-alpine AS build
22
WORKDIR /source
33

4+
ENV GENHTTP_ENGINE_NAME=INTERNAL
5+
ENV GENHTTP_ENGINE_PACKAGE=GenHTTP.Core
6+
47
# copy csproj and restore as distinct layers
58
COPY Benchmarks/*.csproj .
69
RUN dotnet restore -r linux-musl-x64
@@ -10,11 +13,17 @@ COPY Benchmarks/ .
1013
RUN dotnet publish -c release -o /app -r linux-musl-x64 --no-restore --self-contained
1114

1215
# final stage/image
13-
FROM mcr.microsoft.com/dotnet/runtime-deps:9.0-alpine
16+
FROM mcr.microsoft.com/dotnet/runtime-deps:10.0-alpine
1417

15-
ENV DOTNET_GCDynamicAdaptationMode=0
16-
ENV DOTNET_ReadyToRun=0
17-
ENV DOTNET_HillClimbing_Disable=1
18+
ENV DOTNET_GCDynamicAdaptationMode=0 \
19+
DOTNET_EnableDiagnostics=0 \
20+
COMPlus_EnableDiagnostics=0 \
21+
COMPlus_DbgEnableMiniDump=0 \
22+
COMPlus_DbgEnableMiniDumpCollection=0 \
23+
COMPlus_DbgMiniDumpType=0 \
24+
DOTNET_TieredPGO=0 \
25+
DOTNET_TC_QuickJitForLoops=1 \
26+
DOTNET_TC_QuickJit=1
1827

1928
WORKDIR /app
2029
COPY --from=build /app .

frameworks/CSharp/touchsocket/Benchmarks.sln

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 18
4-
VisualStudioVersion = 18.0.11109.219 d18.0-oob
4+
VisualStudioVersion = 18.0.11109.219
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TouchSocketWebApi", "src\TouchSocketWebApi\TouchSocketWebApi.csproj", "{6BD9363A-D77F-5D90-8444-2BC37495C920}"
77
EndProject
@@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TouchSocketHttp31", "src\To
1111
EndProject
1212
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TouchSocketWebApi31", "src\TouchSocketWebApi31\TouchSocketWebApi31.csproj", "{6B6A57CE-1F69-FA6E-7458-0A4B6AB60683}"
1313
EndProject
14+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TouchSocketHttpPlatform", "src\TouchSocketHttpPlatform\TouchSocketHttpPlatform.csproj", "{BC320C24-941D-2109-FBC8-92780569BBA4}"
15+
EndProject
1416
Global
1517
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1618
Debug|Any CPU = Debug|Any CPU
@@ -33,6 +35,10 @@ Global
3335
{6B6A57CE-1F69-FA6E-7458-0A4B6AB60683}.Debug|Any CPU.Build.0 = Debug|Any CPU
3436
{6B6A57CE-1F69-FA6E-7458-0A4B6AB60683}.Release|Any CPU.ActiveCfg = Release|Any CPU
3537
{6B6A57CE-1F69-FA6E-7458-0A4B6AB60683}.Release|Any CPU.Build.0 = Release|Any CPU
38+
{BC320C24-941D-2109-FBC8-92780569BBA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39+
{BC320C24-941D-2109-FBC8-92780569BBA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
40+
{BC320C24-941D-2109-FBC8-92780569BBA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
41+
{BC320C24-941D-2109-FBC8-92780569BBA4}.Release|Any CPU.Build.0 = Release|Any CPU
3642
EndGlobalSection
3743
GlobalSection(SolutionProperties) = preSolution
3844
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)