Skip to content

Commit ea3be61

Browse files
authored
Merge pull request #48 from TechEmpower/master
aa
2 parents fb070f6 + 08e68e4 commit ea3be61

File tree

235 files changed

+3429
-3572
lines changed

Some content is hidden

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

235 files changed

+3429
-3572
lines changed

frameworks/Dart/dart3/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# Created by `dart pub`
33
.dart_tool/
44
*.lock
5-
!bin
5+
!bin

frameworks/Dart/dart3/bin/server.dart

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,22 @@ import 'dart:convert';
22
import 'dart:io';
33
import 'dart:isolate';
44

5-
final _encoder = JsonUtf8Encoder();
6-
7-
void main(List<String> _) async {
8-
/// Create an [Isolate] containinig an [HttpServer]
5+
void main(List<String> args) async {
6+
/// Create an [Isolate] containing an [HttpServer]
97
/// for each processor after the first
108
for (var i = 1; i < Platform.numberOfProcessors; i++) {
11-
await Isolate.spawn(_startServer, _);
9+
await Isolate.spawn(_startServer, args);
1210
}
1311

1412
/// Create a [HttpServer] for the first processor
15-
await _startServer(_);
13+
await _startServer(args);
1614
}
1715

1816
/// Creates and setup a [HttpServer]
1917
Future<void> _startServer(List<String> _) async {
2018
/// Binds the [HttpServer] on `0.0.0.0:8080`.
2119
final server = await HttpServer.bind(
22-
InternetAddress('0.0.0.0', type: InternetAddressType.IPv4),
20+
InternetAddress.anyIPv4,
2321
8080,
2422
shared: true,
2523
);
@@ -51,39 +49,35 @@ void _sendResponse(
5149
int statusCode, {
5250
ContentType? type,
5351
List<int> bytes = const [],
54-
}) =>
55-
request.response
56-
..statusCode = statusCode
57-
..headers.contentType = type
58-
..headers.date = DateTime.now()
59-
..contentLength = bytes.length
60-
..add(bytes)
61-
..close();
52+
}) => request.response
53+
..statusCode = statusCode
54+
..headers.contentType = type
55+
..headers.date = DateTime.now()
56+
..contentLength = bytes.length
57+
..add(bytes)
58+
..close();
6259

6360
/// Completes the given [request] by writing the [response] as JSON.
6461
void _sendJson(HttpRequest request, Object response) => _sendResponse(
65-
request,
66-
HttpStatus.ok,
67-
type: ContentType.json,
68-
bytes: _encoder.convert(response),
69-
);
62+
request,
63+
HttpStatus.ok,
64+
type: ContentType.json,
65+
bytes: _jsonEncoder.convert(response),
66+
);
7067

7168
/// Completes the given [request] by writing the [response] as plain text.
7269
void _sendText(HttpRequest request, String response) => _sendResponse(
73-
request,
74-
HttpStatus.ok,
75-
type: ContentType.text,
76-
bytes: utf8.encode(response),
77-
);
70+
request,
71+
HttpStatus.ok,
72+
type: ContentType.text,
73+
bytes: utf8.encode(response),
74+
);
7875

7976
/// Responds with the JSON test to the [request].
80-
void _jsonTest(HttpRequest request) => _sendJson(
81-
request,
82-
const {'message': 'Hello, World!'},
83-
);
77+
void _jsonTest(HttpRequest request) =>
78+
_sendJson(request, const {'message': 'Hello, World!'});
8479

8580
/// Responds with the plaintext test to the [request].
86-
void _plaintextTest(HttpRequest request) => _sendText(
87-
request,
88-
'Hello, World!',
89-
);
81+
void _plaintextTest(HttpRequest request) => _sendText(request, 'Hello, World!');
82+
83+
final _jsonEncoder = JsonUtf8Encoder();

frameworks/Dart/dart3/dart3.dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
FROM dart:3.5 AS builder
2+
FROM dart:3.8 AS builder
33

44
COPY . /app
55
WORKDIR /app
@@ -11,4 +11,4 @@ COPY --from=builder /runtime/ /
1111
COPY --from=builder /app/build /bin
1212

1313
EXPOSE 8080
14-
CMD ["server"]
14+
CMD ["server"]

frameworks/Dart/dart3/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: dartbenchmark
22
description: A benchmark of dart
33
environment:
4-
sdk: '>=3.5.0 <4.0.0'
4+
sdk: ^3.8.0
55

66
dev_dependencies:
77
lints: ^4.0.0

frameworks/Go/fiber/src/go.mod

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

77
require (
88
github.com/goccy/go-json v0.10.5
9-
github.com/gofiber/fiber/v2 v2.52.6
9+
github.com/gofiber/fiber/v2 v2.52.7
1010
github.com/jackc/pgx/v5 v5.7.4
1111
github.com/valyala/quicktemplate v1.8.0
1212
)

frameworks/Go/fiber/src/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
55
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
66
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
77
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
8-
github.com/gofiber/fiber/v2 v2.52.6 h1:Rfp+ILPiYSvvVuIPvxrBns+HJp8qGLDnLJawAu27XVI=
9-
github.com/gofiber/fiber/v2 v2.52.6/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
8+
github.com/gofiber/fiber/v2 v2.52.7 h1:6xJpE4sSqErvMiEZo9ZpJLRSVcpkNBvioeqAHKwhTZY=
9+
github.com/gofiber/fiber/v2 v2.52.7/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
1010
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
1111
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
1212
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Avaje Jex Benchmarking Test
2+
3+
## Important Libraries
4+
The tests were run with:
5+
* [Java 24](https://openjdk.java.net)
6+
* [Avaje Http 3.3](https://github.com/avaje/avaje-http)
7+
* [Avaje Inject 11.5](https://github.com/avaje/avaje-inject)
8+
* [Avaje Jex 3.2](https://github.com/avaje/avaje-jex)
9+
* [HikariCP 6.3.0](https://github.com/brettwooldridge/HikariCP)
10+
* [jstachio 1.3.7](https://github.com/jstachio/jstachio)
11+
12+
[Avaje Jex](https://avaje.io) is a micro web framework for Java's built-in `jdk.httpserver` API.
13+
14+
```java
15+
Jex.create()
16+
.get("/", ctx -> ctx.text("hello"))
17+
.start();
18+
```
19+
20+
## Test Implementation Source Code
21+
22+
### Plain Text Test
23+
* [Plain test source](src/main/java/benchmark/Main.java)
24+
25+
### JSON Encoding Test
26+
* [JSON test source](src/main/java/benchmark/Main.java)
27+
28+
### Single Query Test
29+
* [Single query test source](src/main/java/benchmark/DatabaseController.java)
30+
31+
### Multiple Queries Test
32+
* [Multiple queries test source](src/main/java/benchmark/DatabaseController.java)
33+
34+
### Database Update Test
35+
* [Database update test source](src/main/java/benchmark/DatabaseController.java)
36+
37+
### Fortunes Test
38+
* [Fortunes test source](src/main/java/benchmark/DatabaseController.java)
39+
40+
## Test URLs
41+
### JSON
42+
43+
http://localhost:8080/json
44+
45+
### PLAINTEXT
46+
47+
http://localhost:8080/plaintext
48+
49+
### DB
50+
51+
http://localhost:8080/db
52+
53+
### QUERY
54+
55+
http://localhost:8080/queries?queries=
56+
57+
### UPDATE
58+
59+
http://localhost:8080/updates?queries=
60+
61+
### FORTUNES
62+
63+
http://localhost:8080/fortunes
64+
65+
## build
66+
67+
### java's httpserver impl
68+
69+
`mvn clean package`
70+
71+
### robaho's httpserver impl
72+
73+
`mvn clean package -P robaho`
74+
75+
### jetty's httpserver impl
76+
77+
`mvn clean package -P jetty`
78+
79+
## run
80+
81+
`java -p ./target/modules/ -m avaje.techempower`
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM maven:3.9.9-eclipse-temurin-24 AS build
2+
WORKDIR /avaje-jex
3+
COPY pom.xml pom.xml
4+
COPY src src
5+
RUN mvn package -q -P jetty
6+
EXPOSE 8080
7+
8+
CMD ["java", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-p", "./target/modules/", "-m", "avaje.techempower"]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM maven:3.9.9-eclipse-temurin-24 AS build
2+
WORKDIR /avaje-jex
3+
COPY pom.xml pom.xml
4+
COPY src src
5+
RUN mvn package -q -P robaho
6+
EXPOSE 8080
7+
8+
CMD ["java", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-p", "./target/modules/", "-m", "avaje.techempower"]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM maven:3.9.9-eclipse-temurin-24 AS build
2+
WORKDIR /avaje-jex
3+
COPY pom.xml pom.xml
4+
COPY src src
5+
RUN mvn package -q
6+
EXPOSE 8080
7+
8+
CMD ["java", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-p", "./target/modules/", "-m", "avaje.techempower"]

0 commit comments

Comments
 (0)