Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frameworks/effinitive/app/Models.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public sealed class ProcessedItem
public double Price { get; set; }
public int Quantity { get; set; }
public bool Active { get; set; }
public List<string> Tags { get; set; } = [];
public RatingInfo Rating { get; set; } = new();
public List<string> Tags { get; set; } = null!;
public RatingInfo Rating { get; set; } = null!;
public double Total { get; set; }
}

Expand Down
12 changes: 3 additions & 9 deletions frameworks/effinitive/app/Tests/Baseline.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Text;
using EffinitiveFramework.Core;
using EffinitiveFramework.Core.Http;

Expand Down Expand Up @@ -29,23 +28,18 @@ public override ValueTask<string> HandleAsync(CancellationToken ct)
}
}

public class BaselinePostEndpoint : NoRequestEndpointBase<string>
public class BaselinePostEndpoint : EndpointBase<string, string>
{
protected override string Method => "POST";
protected override string Route => "/baseline11";
protected override string ContentType => "text/plain";

public override ValueTask<string> HandleAsync(CancellationToken ct)
public override ValueTask<string> HandleAsync(string body, CancellationToken ct = default)
{
var query = HttpContext?.Query ?? QueryCollection.Empty;
int a = query.GetInt("a");
int b = query.GetInt("b");
int bodyVal = 0;
if (HttpContext?.Body.Length > 0)
{
var bodyStr = Encoding.UTF8.GetString(HttpContext.Body.Span).Trim();
int.TryParse(bodyStr, out bodyVal);
}
int.TryParse(body.Trim(), out var bodyVal);
return ValueTask.FromResult((a + b + bodyVal).ToString());
}
}
Expand Down
10 changes: 7 additions & 3 deletions frameworks/effinitive/app/Tests/Json.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

namespace effinitive.Tests;

public class JsonEndpoint : NoRequestEndpointBase<ResponseDto<ProcessedItem>>
// Returns byte[] so SerializeResponse short-circuits into the pre-serialized path,
// bypassing reflection-based JsonSerializerOptions entirely.
public class JsonEndpoint : NoRequestEndpointBase<byte[]>
{
protected override string Method => "GET";
protected override string Route => "/json/{count}";
Expand All @@ -24,7 +26,7 @@ private static DatasetItem[] LoadItems()
return [.. items];
}

public override ValueTask<ResponseDto<ProcessedItem>> HandleAsync(CancellationToken ct)
public override ValueTask<byte[]> HandleAsync(CancellationToken ct)
{
var query = HttpContext?.Query ?? QueryCollection.Empty;
int count = int.TryParse(HttpContext?.RouteValues?["count"]?.ToString(), out var c) ? c : AllItems.Length;
Expand All @@ -44,6 +46,8 @@ public override ValueTask<ResponseDto<ProcessedItem>> HandleAsync(CancellationTo
};
}

return ValueTask.FromResult(new ResponseDto<ProcessedItem>(processed, take));
var dto = new ResponseDto<ProcessedItem>(processed, take);
return ValueTask.FromResult(
JsonSerializer.SerializeToUtf8Bytes(dto, AppJsonContext.Default.ResponseDtoProcessedItem));
}
}
26 changes: 1 addition & 25 deletions frameworks/effinitive/app/Tests/Upload.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Buffers;
using EffinitiveFramework.Core;
using EffinitiveFramework.Core.Http;

Expand All @@ -11,28 +10,5 @@ public class UploadEndpoint : NoRequestEndpointBase<string>
protected override string ContentType => "text/plain";

public override async ValueTask<string> HandleAsync(CancellationToken ct)
{
long size = 0;

if (HttpContext?.BodyDeferred == true && HttpContext.BodyStream != null)
{
var buffer = ArrayPool<byte>.Shared.Rent(65536);
try
{
int read;
while ((read = await HttpContext.BodyStream.ReadAsync(buffer.AsMemory(0, 65536), ct)) > 0)
size += read;
}
finally
{
ArrayPool<byte>.Shared.Return(buffer);
}
}
else
{
size = HttpContext?.Body.Length ?? 0;
}

return size.ToString();
}
=> (await HttpContext!.CountBodyBytesAsync(ct)).ToString();
}
2 changes: 1 addition & 1 deletion frameworks/effinitive/app/effinitive-arena.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EffinitiveFramework.Core" Version="2.0.0" />
<PackageReference Include="EffinitiveFramework.Core" Version="2.1.3" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="10.0.5" />
<PackageReference Include="Npgsql" Version="10.0.2" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions frameworks/effinitive/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"pipelined",
"limited-conn",
"json",
"json-comp",
"upload",
"api-4",
"api-16",
Expand Down
24 changes: 12 additions & 12 deletions site/data/api-16-1024.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,28 +207,28 @@
{
"framework": "effinitive",
"language": "C#",
"rps": 78773,
"avg_latency": "11.18ms",
"p99_latency": "64.20ms",
"cpu": "1545.2%",
"memory": "314MiB",
"rps": 93625,
"avg_latency": "9.28ms",
"p99_latency": "55.00ms",
"cpu": "1506.2%",
"memory": "348MiB",
"connections": 1024,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "404.54MB/s",
"input_bw": "4.43MB/s",
"reconnects": 236210,
"status_2xx": 1181609,
"bandwidth": "480.87MB/s",
"input_bw": "5.27MB/s",
"reconnects": 280741,
"status_2xx": 1404389,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0,
"tpl_baseline": 443394,
"tpl_json": 442944,
"tpl_baseline": 526887,
"tpl_json": 526984,
"tpl_db": 0,
"tpl_upload": 0,
"tpl_static": 0,
"tpl_async_db": 295270
"tpl_async_db": 350515
},
{
"framework": "elysia",
Expand Down
24 changes: 12 additions & 12 deletions site/data/api-4-256.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,28 +207,28 @@
{
"framework": "effinitive",
"language": "C#",
"rps": 46030,
"avg_latency": "3.81ms",
"p99_latency": "20.40ms",
"cpu": "394.3%",
"memory": "280MiB",
"rps": 36309,
"avg_latency": "5.55ms",
"p99_latency": "28.10ms",
"cpu": "397.3%",
"memory": "279MiB",
"connections": 256,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "236.42MB/s",
"input_bw": "2.59MB/s",
"reconnects": 138067,
"status_2xx": 690460,
"bandwidth": "186.50MB/s",
"input_bw": "2.04MB/s",
"reconnects": 108919,
"status_2xx": 544649,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0,
"tpl_baseline": 259043,
"tpl_json": 259012,
"tpl_baseline": 204327,
"tpl_json": 204344,
"tpl_db": 0,
"tpl_upload": 0,
"tpl_static": 0,
"tpl_async_db": 172404
"tpl_async_db": 135978
},
{
"framework": "elysia",
Expand Down
16 changes: 8 additions & 8 deletions site/data/async-db-1024.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,19 @@
{
"framework": "effinitive",
"language": "C#",
"rps": 166493,
"avg_latency": "5.59ms",
"rps": 165916,
"avg_latency": "5.70ms",
"p99_latency": "13.50ms",
"cpu": "3522.6%",
"memory": "568MiB",
"cpu": "3420.7%",
"memory": "560MiB",
"connections": 1024,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "653.71MB/s",
"input_bw": "11.11MB/s",
"reconnects": 66484,
"status_2xx": 1664936,
"bandwidth": "651.47MB/s",
"input_bw": "11.08MB/s",
"reconnects": 66221,
"status_2xx": 1659162,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
Expand Down
16 changes: 8 additions & 8 deletions site/data/baseline-4096.json
Original file line number Diff line number Diff line change
Expand Up @@ -257,19 +257,19 @@
{
"framework": "effinitive",
"language": "C#",
"rps": 1435736,
"avg_latency": "2.82ms",
"p99_latency": "6.43ms",
"cpu": "5790.0%",
"memory": "1.6GiB",
"rps": 1405011,
"avg_latency": "2.88ms",
"p99_latency": "7.29ms",
"cpu": "5874.5%",
"memory": "1.7GiB",
"connections": 4096,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "233.63MB/s",
"input_bw": "110.91MB/s",
"bandwidth": "228.80MB/s",
"input_bw": "108.53MB/s",
"reconnects": 0,
"status_2xx": 7178680,
"status_2xx": 7025056,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
Expand Down
16 changes: 8 additions & 8 deletions site/data/baseline-512.json
Original file line number Diff line number Diff line change
Expand Up @@ -257,19 +257,19 @@
{
"framework": "effinitive",
"language": "C#",
"rps": 1385487,
"avg_latency": "333us",
"p99_latency": "1.50ms",
"cpu": "5618.1%",
"memory": "431MiB",
"rps": 1330634,
"avg_latency": "350us",
"p99_latency": "2.18ms",
"cpu": "5669.9%",
"memory": "420MiB",
"connections": 512,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "223.86MB/s",
"input_bw": "107.03MB/s",
"bandwidth": "213.80MB/s",
"input_bw": "102.79MB/s",
"reconnects": 0,
"status_2xx": 6927437,
"status_2xx": 6653174,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
Expand Down
13 changes: 7 additions & 6 deletions site/data/baseline-h2-1024.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,18 @@
{
"framework": "effinitive",
"language": "C#",
"rps": 2021859,
"avg_latency": "27.45ms",
"cpu": "6136.2%",
"memory": "12.9GiB",
"rps": 1909651,
"avg_latency": "30.52ms",
"p99_latency": "1.24s",
"cpu": "5883.2%",
"memory": "6.6GiB",
"connections": 1024,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "64.28MB/s",
"bandwidth": "60.83MB/s",
"reconnects": 0,
"status_2xx": 10210392,
"status_2xx": 9662839,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
Expand Down
13 changes: 7 additions & 6 deletions site/data/baseline-h2-256.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,18 @@
{
"framework": "effinitive",
"language": "C#",
"rps": 1876072,
"avg_latency": "11.05ms",
"cpu": "6266.4%",
"memory": "2.5GiB",
"rps": 1897958,
"avg_latency": "10.99ms",
"p99_latency": "522.70ms",
"cpu": "6256.9%",
"memory": "2.4GiB",
"connections": 256,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "59.40MB/s",
"bandwidth": "59.97MB/s",
"reconnects": 0,
"status_2xx": 9436643,
"status_2xx": 9527751,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
Expand Down
14 changes: 7 additions & 7 deletions site/data/baseline-h3-64.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@
{
"framework": "effinitive",
"language": "C#",
"rps": 100377,
"avg_latency": "39.56ms",
"p99_latency": "125.07ms",
"cpu": "1950.7%",
"memory": "569MiB",
"rps": 158141,
"avg_latency": "25.32ms",
"p99_latency": "79.07ms",
"cpu": "1903.9%",
"memory": "626MiB",
"connections": 64,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "1.15MB/s",
"bandwidth": "1.81MB/s",
"reconnects": 0,
"status_2xx": 502893,
"status_2xx": 792290,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
Expand Down
14 changes: 7 additions & 7 deletions site/data/echo-ws-16384.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,18 @@
{
"framework": "effinitive",
"language": "C#",
"rps": 404118,
"avg_latency": "11.53ms",
"p99_latency": "52.80ms",
"cpu": "2517.1%",
"memory": "3.2GiB",
"rps": 376683,
"avg_latency": "11.24ms",
"p99_latency": "45.70ms",
"cpu": "2309.9%",
"memory": "2.9GiB",
"connections": 16384,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "2.90MB/s",
"bandwidth": "2.71MB/s",
"reconnects": 0,
"status_2xx": 2020592,
"status_2xx": 1883419,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
Expand Down
Loading