Răsfoiți Sursa

Add Celerio C# framework benchmark (#10129)

* Add Celerio C# framework benchmark

* Add Celerio C# framework benchmark

* Readme fix
Oxule 3 săptămâni în urmă
părinte
comite
6823e07aa4

+ 23 - 0
frameworks/CSharp/celerio/README.md

@@ -0,0 +1,23 @@
+# Celerio Benchmarks
+
+Celerio is a modern C# framework designed for high-performance web applications based on Source Generation **only**.  
+This benchmark tests Celerio using the standard TechEmpower FrameworkBenchmarks suite.
+
+## Links
+
+- [GitHub](https://github.com/Oxule/Celerio)
+- [NuGet](https://www.nuget.org/packages/Celerio)
+
+## Infrastructure Software Versions
+
+- C# 12
+- .NET 8
+
+## Benchmarks Included
+
+- **Plaintext**
+- **JSON**
+
+## Author
+
+* [Oxule](https://github.com/Oxule)

+ 26 - 0
frameworks/CSharp/celerio/benchmark_config.json

@@ -0,0 +1,26 @@
+{
+  "framework": "celerio",
+  "tests": [
+    {
+      "default": {
+        "json_url": "/json",
+        "plaintext_url": "/plaintext",
+        "port": 8080,
+        "approach": "Realistic",
+        "classification": "Micro",
+        "database": "None",
+        "framework": "Celerio",
+        "language": "CSharp",
+        "flavor": "None",
+        "orm": "None",
+        "platform": ".NET",
+        "webserver": "Celerio",
+        "os": "Linux",
+        "database_os": "Linux",
+        "display_name": "Celerio",
+        "notes": "",
+        "versus": "aspcore-mvc"
+      }
+    }
+  ]
+}

+ 24 - 0
frameworks/CSharp/celerio/celerio.dockerfile

@@ -0,0 +1,24 @@
+FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
+USER $APP_UID
+WORKDIR /app
+
+FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
+ARG BUILD_CONFIGURATION=Release
+WORKDIR /src
+COPY ["src/src.csproj", "src/"]
+RUN dotnet restore "src/src.csproj"
+COPY . .
+WORKDIR "/src/src"
+RUN dotnet build "./src.csproj" -c $BUILD_CONFIGURATION -o /app/build
+
+FROM build AS publish
+ARG BUILD_CONFIGURATION=Release
+RUN dotnet publish "./src.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
+
+FROM base AS final
+WORKDIR /app
+COPY --from=publish /app/publish .
+
+EXPOSE 8080
+
+ENTRYPOINT ["dotnet", "src.dll"]

+ 15 - 0
frameworks/CSharp/celerio/config.toml

@@ -0,0 +1,15 @@
+[framework]
+name = "celerio"
+
+[main]
+urls.plaintext = "/plaintext"
+urls.json = "/json"
+approach = "Realistic"
+classification = "Micro"
+database = "None"
+database_os = "Linux"
+os = "Linux"
+orm = "None"
+platform = ".NET"
+webserver = "Celerio"
+versus = "aspcore-mvc"

+ 25 - 0
frameworks/CSharp/celerio/src/.dockerignore

@@ -0,0 +1,25 @@
+**/.dockerignore
+**/.env
+**/.git
+**/.gitignore
+**/.project
+**/.settings
+**/.toolstarget
+**/.vs
+**/.vscode
+**/.idea
+**/*.*proj.user
+**/*.dbmdl
+**/*.jfm
+**/azds.yaml
+**/bin
+**/charts
+**/docker-compose*
+**/Dockerfile*
+**/node_modules
+**/npm-debug.log
+**/obj
+**/secrets.dev.yaml
+**/values.dev.yaml
+LICENSE
+README.md

+ 25 - 0
frameworks/CSharp/celerio/src/Endpoints.cs

@@ -0,0 +1,25 @@
+namespace src;
+
+using Celerio;
+using static Celerio.Result;
+
+public static class Endpoints
+{
+    [Get("/plaintext")]
+    public static Result Plaintext()
+    {
+        return Ok().Text("Hello, World!");
+    }
+
+    [Serializable]
+    public class SampleResponse
+    {
+        public string message { get; set; } = "Hello, World!";
+    }
+    
+    [Get("/json")]
+    public static Result Json()
+    {
+        return Ok().Json(new SampleResponse());
+    }
+}

+ 6 - 0
frameworks/CSharp/celerio/src/Program.cs

@@ -0,0 +1,6 @@
+using System.Net;
+using Celerio.Generated;
+
+var server = new Server(IPAddress.Any, 8080);
+server.Start();
+await Task.Delay(Timeout.Infinite);

+ 18 - 0
frameworks/CSharp/celerio/src/src.csproj

@@ -0,0 +1,18 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+    <PropertyGroup>
+        <OutputType>Exe</OutputType>
+        <TargetFramework>net8.0</TargetFramework>
+        <LangVersion>preview</LangVersion>
+        <ImplicitUsings>enable</ImplicitUsings>
+        <Nullable>enable</Nullable>
+        <!--<PublishAot>true</PublishAot>-->
+        <InvariantGlobalization>true</InvariantGlobalization>
+        <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
+    </PropertyGroup>
+
+    <ItemGroup>
+      <PackageReference Include="Celerio" Version="2.0.0-preview.1" />
+    </ItemGroup>
+
+</Project>