Skip to content

Commit 968ea5c

Browse files
authored
Merge pull request #39 from TechEmpower/master
aa
2 parents 0506444 + bca3822 commit 968ea5c

File tree

207 files changed

+3307
-1238
lines changed

Some content is hidden

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

207 files changed

+3307
-1238
lines changed

frameworks/C++/poco/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# POCO C++ Libraries Benchmarking Test
2+
3+
- [POCO Github Repository](https://github.com/pocoproject/poco)
4+
- [POCO Website](https://pocoproject.org/)
5+
6+
## Software Versions
7+
8+
- [buildpack-deps noble](https://hub.docker.com/_/buildpack-deps)
9+
- [g++ 14](https://gcc.gnu.org/gcc-14/)
10+
- [c++17](https://en.cppreference.com/w/cpp/17)
11+
- [POCO 1.13.1](https://pocoproject.org/releases/poco-1.13.1/poco-1.13.1-all.zip)
12+
13+
## Test URLs
14+
15+
- `PLAINTEXT` - [http://127.0.0.1:8080/plaintext](http://127.0.0.1:8080/plaintext)

frameworks/C++/poco/benchmark.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include <Poco/Net/HTTPServerRequest.h>
77
#include <Poco/Net/HTTPServerResponse.h>
88
#include <Poco/Util/ServerApplication.h>
9+
#include <Poco/Timespan.h>
10+
#include <Poco/Thread.h>
911

1012
#include <iostream>
1113
#include <string>
@@ -15,7 +17,9 @@
1517
#define PLAIN_CONTENT_TYPE "text/plain"
1618
#define RES_BODY "Hello, World!"
1719
#define SERVER_NAME "poco"
20+
#define MAX_CONNECTIONS 16384
1821

22+
using namespace Poco;
1923
using namespace Poco::Net;
2024
using namespace Poco::Util;
2125
using namespace std;
@@ -58,7 +62,12 @@ class MyServerApp : public ServerApplication {
5862
HTTPServerParams* hsp = new HTTPServerParams;
5963
hsp->setMaxThreads(stoi(args[1]));
6064
hsp->setKeepAlive(true);
61-
HTTPServer s(new MyRequestHandlerFactory, ServerSocket(stoi(args[0]), 4000), hsp);
65+
hsp->setMaxKeepAliveRequests(MAX_CONNECTIONS);
66+
hsp->setMaxQueued(MAX_CONNECTIONS);
67+
hsp->setThreadPriority(Thread::PRIO_HIGHEST);
68+
ServerSocket socket(stoi(args[0]), MAX_CONNECTIONS);
69+
socket.setBlocking(false);
70+
HTTPServer s(new MyRequestHandlerFactory, socket, hsp);
6271
s.start();
6372
waitForTerminationRequest();
6473
s.stop();

frameworks/C++/poco/poco.dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
FROM buildpack-deps:xenial
1+
FROM buildpack-deps:noble
22

33
RUN apt-get update -yqq && apt-get install -yqq software-properties-common unzip cmake
44

5-
RUN apt-get install -yqq g++-4.8 libjson0-dev
6-
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
5+
RUN apt-get install -yqq g++-14
6+
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 50
77

8-
ENV POCO_VERSION 1.6.1
8+
ENV POCO_VERSION 1.13.3
99
ENV POCO_HOME /poco
1010

1111
WORKDIR ${POCO_HOME}
@@ -20,10 +20,10 @@ ENV LD_LIBRARY_PATH ${POCO_HOME}/lib/Linux/x86_64
2020

2121
COPY benchmark.cpp benchmark.cpp
2222

23-
RUN g++-4.8 \
23+
RUN g++-14 \
2424
-O3 \
2525
-DNDEBUG \
26-
-std=c++0x \
26+
-std=c++17 \
2727
-o \
2828
poco \
2929
benchmark.cpp \

frameworks/CSharp/aspnetcore/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ See [.NET Core](http://dot.net) and [ASP.NET Core](https://github.com/dotnet/asp
66

77
**Language**
88

9-
* C# 8.0
9+
* C# 13.0
1010

frameworks/CSharp/aspnetcore/benchmark_config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"json_url": "/json",
3131
"db_url": "/db",
3232
"query_url": "/queries/",
33+
"fortune_url": "/fortunes",
3334
"update_url": "/updates/",
3435
"cached_query_url": "/cached-worlds/",
3536
"port": 8080,

frameworks/CSharp/aspnetcore/src/Minimal/Minimal.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Npgsql" Version="8.0.5" />
12+
<PackageReference Include="Npgsql" Version="9.0.2" />
1313
<PackageReference Include="Dapper" Version="2.1.35" />
1414
<PackageReference Include="RazorSlices" Version="0.8.1" />
1515
</ItemGroup>

frameworks/CSharp/aspnetcore/src/Mvc/Mvc.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Npgsql" Version="8.0.5" />
13-
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.0-rc.2" />
12+
<PackageReference Include="Npgsql" Version="9.0.2" />
13+
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.2" />
1414
</ItemGroup>
1515

1616
</Project>

frameworks/CSharp/aspnetcore/src/Platform/BenchmarkApplication.Caching.cs

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

77
namespace PlatformBenchmarks;
88

9-
public partial class BenchmarkApplication
9+
public sealed partial class BenchmarkApplication
1010
{
1111
private static async Task Caching(PipeWriter pipeWriter, int count)
1212
{

frameworks/CSharp/aspnetcore/src/Platform/BenchmarkApplication.Fortunes.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4-
#if !AOT
4+
using System;
55
using System.IO.Pipelines;
66
using System.Runtime.CompilerServices;
77
using System.Threading.Tasks;
88
using RazorSlices;
99

1010
namespace PlatformBenchmarks;
1111

12-
public partial class BenchmarkApplication
12+
public sealed partial class BenchmarkApplication
1313
{
1414
private async Task FortunesRaw(PipeWriter pipeWriter)
1515
{
@@ -19,7 +19,7 @@ await RawDb.LoadFortunesRows(),
1919
FortunesTemplateFactory);
2020
}
2121

22-
private ValueTask OutputFortunes<TModel>(PipeWriter pipeWriter, TModel model, SliceFactory<TModel> templateFactory)
22+
private ValueTask OutputFortunes<TModel>(PipeWriter pipeWriter, TModel model, Func<TModel, RazorSlice<TModel>> templateFactory)
2323
{
2424
// Render headers
2525
var preamble = """
@@ -39,7 +39,7 @@ private ValueTask OutputFortunes<TModel>(PipeWriter pipeWriter, TModel model, Sl
3939
// Kestrel PipeWriter span size is 4K, headers above already written to first span & template output is ~1350 bytes,
4040
// so 2K chunk size should result in only a single span and chunk being used.
4141
var chunkedWriter = GetChunkedWriter(pipeWriter, chunkSizeHint: 2048);
42-
var renderTask = template.RenderAsync(chunkedWriter, null, HtmlEncoder);
42+
var renderTask = template.RenderAsync(chunkedWriter, HtmlEncoder);
4343

4444
if (renderTask.IsCompletedSuccessfully)
4545
{
@@ -51,18 +51,17 @@ private ValueTask OutputFortunes<TModel>(PipeWriter pipeWriter, TModel model, Sl
5151
return AwaitTemplateRenderTask(renderTask, chunkedWriter, template);
5252
}
5353

54-
private static async ValueTask AwaitTemplateRenderTask(ValueTask renderTask, ChunkedBufferWriter<WriterAdapter> chunkedWriter, RazorSlice template)
54+
private static async ValueTask AwaitTemplateRenderTask(ValueTask renderTask, ChunkedPipeWriter chunkedWriter, RazorSlice template)
5555
{
5656
await renderTask;
5757
EndTemplateRendering(chunkedWriter, template);
5858
}
5959

6060
[MethodImpl(MethodImplOptions.AggressiveInlining)]
61-
private static void EndTemplateRendering(ChunkedBufferWriter<WriterAdapter> chunkedWriter, RazorSlice template)
61+
private static void EndTemplateRendering(ChunkedPipeWriter chunkedWriter, RazorSlice template)
6262
{
63-
chunkedWriter.End();
63+
chunkedWriter.Complete();
6464
ReturnChunkedWriter(chunkedWriter);
6565
template.Dispose();
6666
}
6767
}
68-
#endif

frameworks/CSharp/aspnetcore/src/Platform/BenchmarkApplication.HttpConnection.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace PlatformBenchmarks;
1414

15-
public partial class BenchmarkApplication : IHttpConnection
15+
public sealed partial class BenchmarkApplication : IHttpConnection
1616
{
1717
private State _state;
1818

@@ -193,15 +193,15 @@ private static BufferWriter<WriterAdapter> GetWriter(PipeWriter pipeWriter, int
193193
=> new(new(pipeWriter), sizeHint);
194194

195195
[MethodImpl(MethodImplOptions.AggressiveInlining)]
196-
private static ChunkedBufferWriter<WriterAdapter> GetChunkedWriter(PipeWriter pipeWriter, int chunkSizeHint)
196+
private static ChunkedPipeWriter GetChunkedWriter(PipeWriter pipeWriter, int chunkSizeHint)
197197
{
198198
var writer = ChunkedWriterPool.Get();
199-
writer.SetOutput(new WriterAdapter(pipeWriter), chunkSizeHint);
199+
writer.SetOutput(pipeWriter, chunkSizeHint);
200200
return writer;
201201
}
202202

203203
[MethodImpl(MethodImplOptions.AggressiveInlining)]
204-
private static void ReturnChunkedWriter(ChunkedBufferWriter<WriterAdapter> writer) => ChunkedWriterPool.Return(writer);
204+
private static void ReturnChunkedWriter(ChunkedPipeWriter writer) => ChunkedWriterPool.Return(writer);
205205

206206
private struct WriterAdapter : IBufferWriter<byte>
207207
{

0 commit comments

Comments
 (0)