Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

Commit daf5842

Browse files
authored
Delete dart3_hybrid test (#10780)
* remove superseeded code and unnecessary dependencies * bump dependencies * move Dockerfile(s) in specific test folders * move server.dart in specific test folders and remove unnecessary code * update path bin/server.dart relative to the root context * update readme * delete server.dart in root folder * add update dart_hybrid implementation * remove dart_hybrid implementation * move dockerfiles in root folder * add myself as maintainer * fix typo in dockerfile name
1 parent 6665384 commit daf5842

12 files changed

Lines changed: 165 additions & 198 deletions

File tree

frameworks/Dart/dart3/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
.dart_tool/
22
*.lock
3-
3+
!bin

frameworks/Dart/dart3/README.md

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
11
# Dart 3 Benchmarking Test
22

3-
## Test Type Implementation Source Code
4-
5-
- [JSON](server.dart)
6-
- [PLAINTEXT](server.dart)
7-
83
## Important Libraries
94

105
The tests were run with:
116

12-
- [Dart v3.10.8](https://dart.dev/)
7+
- [Dart v3.11.0](https://dart.dev/)
8+
9+
## Benchmark Variants
10+
11+
### Native
12+
13+
Minimal implementation with the smallest resource footprint.
14+
Supports basic horizontal scaling via [Isolates](https://dart.dev/language/isolates) and socket sharing.
15+
([source code](https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/frameworks/Dart/dart3/dart_native))
16+
17+
Test URLs:
1318

14-
## Test URLs
19+
- JSON: `http://localhost:8080/json`
20+
- PLAINTEXT: `http://localhost:8080/plaintext`
1521

16-
### JSON
22+
### AOT
1723

18-
`http://localhost:8080/json`
24+
Performance-oriented AOT implementation for superior horizontal scaling.
25+
Achieves lowest latency and higher throughput with a slightly larger footprint.
26+
([source code](https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/frameworks/Dart/dart3/dart_aot))
1927

20-
### PLAINTEXT
28+
Test URLs:
2129

22-
`http://localhost:8080/plaintext`
30+
- JSON: `http://localhost:8080/json`
31+
- PLAINTEXT: `http://localhost:8080/plaintext`

frameworks/Dart/dart3/benchmark_config.json

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"framework": "dart3",
3+
"maintainers": ["iapicca"],
34
"tests": [{
45
"default": {
56
"display_name": "dart3_native",
@@ -24,18 +25,6 @@
2425
"language": "Dart",
2526
"os": "Linux",
2627
"database_os": "Linux"
27-
},
28-
"hybrid": {
29-
"display_name": "dart3_hybrid",
30-
"json_url": "/json",
31-
"plaintext_url": "/plaintext",
32-
"port": 8080,
33-
"approach": "Stripped",
34-
"classification": "Platform",
35-
"database": "None",
36-
"language": "Dart",
37-
"os": "Linux",
38-
"database_os": "Linux"
3928
}
4029
}]
4130
}

frameworks/Dart/dart3/dart3-aot.dockerfile

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

2-
FROM dart:3.10.8 AS build
2+
FROM dart:3.11.0 AS build
33
WORKDIR /app
44

5-
# Define the build-time argument (Default to 8)
65
ARG MAX_ISOLATES=8
76

87
COPY pubspec.yaml .
9-
COPY bin bin
8+
COPY dart_native/bin/ bin/
109

1110
RUN dart compile aot-snapshot bin/server.dart \
1211
--define=MAX_ISOLATES=${MAX_ISOLATES} \
@@ -20,5 +19,4 @@ COPY --from=build /app/server.aot /app/server.aot
2019

2120
EXPOSE 8080
2221

23-
# Distroless requires absolute paths
2422
ENTRYPOINT ["/usr/lib/dart/bin/dartaotruntime", "/app/server.aot"]

frameworks/Dart/dart3/dart3-hybrid.dockerfile

Lines changed: 0 additions & 34 deletions
This file was deleted.

frameworks/Dart/dart3/dart3.dockerfile

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

2-
FROM dart:3.10.8 AS build
2+
FROM dart:3.11.0 AS build
33
WORKDIR /app
44

55
COPY pubspec.yaml .
6-
COPY bin bin
6+
COPY dart_native/bin/ bin/
77

88
RUN dart compile exe bin/server.dart -o server
99

frameworks/Dart/dart3/bin/server.dart renamed to frameworks/Dart/dart3/dart_aot/bin/server.dart

Lines changed: 41 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import 'dart:convert';
22
import 'dart:io';
33
import 'dart:isolate';
44
import 'dart:math' show min;
5-
import 'package:args/args.dart' show ArgParser;
65

76
/// Environment declarations are evaluated at compile-time. Use 'const' to
87
/// ensure values are baked into AOT/Native binaries for the benchmark.
@@ -14,49 +13,54 @@ import 'package:args/args.dart' show ArgParser;
1413
/// but most ahead-of-time compiled platforms will not have this information."
1514
const _maxIsolatesfromEnvironment = int.fromEnvironment('MAX_ISOLATES');
1615

16+
/// The fixed TCP port used by the server.
17+
/// Defined here for visibility and ease of configuration.
18+
const _defaultPort = 8080;
19+
20+
/// A reusable instance of the UTF-8 JSON encoder to efficiently
21+
/// transform Dart objects into byte arrays for HTTP responses.
22+
final _jsonEncoder = JsonUtf8Encoder();
23+
24+
/// Internal token used to notify newly spawned processes that they
25+
/// belong to a secondary "worker group".
26+
const workerGroupTag = '--workerGroup';
27+
1728
void main(List<String> args) {
1829
/// Defines local isolate quota, using MAX_ISOLATES if provided.
1930
/// Falls back to total available cores while respecting hardware limits.
2031
var maxIsolates = _maxIsolatesfromEnvironment > 0
2132
? min(_maxIsolatesfromEnvironment, Platform.numberOfProcessors)
2233
: Platform.numberOfProcessors;
2334

24-
/// Triggers process-level horizontal scaling when running in AOT.
25-
if (Platform.script.toFilePath().endsWith('.aot')) {
26-
/// Internal token used to notify newly spawned processes that they
27-
/// belong to a secondary "worker group".
28-
const workerGroupTag = '--workerGroup';
29-
30-
/// Determine if this process instance was initialized as a worker group.
31-
final isWorkerGroup = args.contains(workerGroupTag);
35+
/// Determine if this process instance was initialized as a worker group.
36+
final isWorkerGroup = args.contains(workerGroupTag);
3237

33-
if (isWorkerGroup) {
34-
/// Sanitize the argument list to ensure the internal token does not
35-
/// interfere with application-level argument parsing.
36-
args.removeAt(args.indexOf(workerGroupTag));
37-
}
38-
/// Prevents recursive spawning
39-
/// by ensuring only the primary process can spawn worker groups
40-
else {
41-
/// Calculate the number of secondary worker groups required
42-
/// to fully utilize the available hardware capacity.
43-
///
44-
/// Each group serves as a container for multiple isolates,
45-
/// helping to bypass internal VM scaling bottlenecks.
46-
final workerGroups = Platform.numberOfProcessors ~/ maxIsolates - 1;
47-
48-
/// Bootstraps independent worker processes via AOT snapshots.
49-
/// Each process initializes its own Isolate Group.
50-
for (var i = 0; i < workerGroups; i++) {
51-
/// [Platform.script] identifies the AOT snapshot or executable.
52-
/// [Isolate.spawnUri] spawns a new process group via [main()].
53-
Isolate.spawnUri(Platform.script, [...args, workerGroupTag], null);
54-
}
55-
56-
/// Updates local isolate limits, assigning the primary group
57-
/// the remaining cores after worker group allocation.
58-
maxIsolates = Platform.numberOfProcessors - workerGroups * maxIsolates;
38+
if (isWorkerGroup) {
39+
/// Sanitize the argument list to ensure the internal token does not
40+
/// interfere with application-level argument parsing.
41+
args.removeAt(args.indexOf(workerGroupTag));
42+
}
43+
/// Prevents recursive spawning
44+
/// by ensuring only the primary process can spawn worker groups
45+
else {
46+
/// Calculate the number of secondary worker groups required
47+
/// to fully utilize the available hardware capacity.
48+
///
49+
/// Each group serves as a container for multiple isolates,
50+
/// helping to bypass internal VM scaling bottlenecks.
51+
final workerGroups = Platform.numberOfProcessors ~/ maxIsolates - 1;
52+
53+
/// Bootstraps independent worker processes via AOT snapshots.
54+
/// Each process initializes its own Isolate Group.
55+
for (var i = 0; i < workerGroups; i++) {
56+
/// [Platform.script] identifies the AOT snapshot or executable.
57+
/// [Isolate.spawnUri] spawns a new process group via [main()].
58+
Isolate.spawnUri(Platform.script, [...args, workerGroupTag], null);
5959
}
60+
61+
/// Updates local isolate limits, assigning the primary group
62+
/// the remaining cores after worker group allocation.
63+
maxIsolates = Platform.numberOfProcessors - workerGroups * maxIsolates;
6064
}
6165

6266
/// Create an [Isolate] containing an [HttpServer]
@@ -74,14 +78,14 @@ void _startServer(List<String> args) async {
7478
/// Binds the [HttpServer] on `0.0.0.0:8080`.
7579
final server = await HttpServer.bind(
7680
InternetAddress.anyIPv4,
77-
_portParser(args, defaultPort: 8080),
81+
_defaultPort,
7882
shared: true,
7983
);
8084

8185
server
8286
..defaultResponseHeaders.clear()
8387
/// Sets [HttpServer]'s [serverHeader].
84-
..serverHeader = 'dart'
88+
..serverHeader = 'dart_aot'
8589
/// Handles [HttpRequest]'s from [HttpServer].
8690
..listen(_handleRequest);
8791
}
@@ -142,18 +146,3 @@ void _plaintextTest(HttpRequest request) => _sendText(
142146
request,
143147
'Hello, World!',
144148
);
145-
146-
final _jsonEncoder = JsonUtf8Encoder();
147-
148-
int _portParser(
149-
List<String> args, {
150-
required int defaultPort,
151-
portTag = 'port',
152-
}) {
153-
final parser = ArgParser()
154-
..addOption(
155-
portTag,
156-
defaultsTo: '$defaultPort',
157-
);
158-
return int.tryParse(parser.parse(args)[portTag]) ?? defaultPort;
159-
}

frameworks/Dart/dart3/dart_hybrid/run.sh

Lines changed: 0 additions & 41 deletions
This file was deleted.

frameworks/Dart/dart3/dart_hybrid/traefik.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

frameworks/Dart/dart3/dart_hybrid/traefik_dynamic.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)