Browse Source

[dart/dart] Remove Dart 1 (#10397)

Dart currently fails and Dart 1 seems to be deprecated.
Petrik de Heus 2 days ago
parent
commit
f3b368884c

+ 0 - 42
frameworks/Dart/dart/README.md

@@ -1,42 +0,0 @@
-# Dart Benchmarking Test
-
-This is the dart portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
-
-## Versions
-
-* [Dart SDK version >=1.6.0](https://dart.dev/)
-* [Dart args version 0.12.0+2](https://pub.dev/packages/args)
-* [Dart crypto version 0.9.0](https://pub.dev/packages/crypto)
-* [Dart mustache version 0.1.8](https://pub.dev/packages/mustache)
-* [Dart postgresql version 0.2.14](https://pub.dev/packages/postgresql)
-* [Dart yaml version 2.0.1+1](https://pub.dev/packages/yaml)
-
-## Test URLs
-
-### JSON Encoding Test
-
-http://localhost:8080/
-
-### Data-Store/Database Mapping Test
-
-http://localhost:8080/db
-
-### Variable Query Test
-
-http://localhost:8080/db?queries=2
-
-### Fortunes Test
-
-http://localhost:8080/fortunes
-
-### Data-Store/Database Update Test
-
-http://localhost:8080/update
-
-### Variable Update Test
-
-http://localhost:8080/update?queries=2
-
-### Plaintext Test
-
-http://localhost:8080/plaintext

+ 0 - 28
frameworks/Dart/dart/benchmark_config.json

@@ -1,28 +0,0 @@
-{
-  "framework": "dart",
-  "tests": [{
-    "default": {
-      "json_url": "/json",
-      "db_url": "/db",
-      "query_url": "/queries?queries=",
-      "fortune_url": "/fortunes",
-      "update_url": "/updates?queries=",
-      "plaintext_url": "/plaintext",
-      "port": 8080,
-      "approach": "Stripped",
-      "classification": "Platform",
-      "database": "Postgres",
-      "framework": "None",
-      "language": "Dart",
-      "flavor": "None",
-      "orm": "Raw",
-      "platform": "None",
-      "webserver": "None",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "dart",
-      "notes": "",
-      "versus": "dart"
-    }
-  }]
-}

+ 0 - 19
frameworks/Dart/dart/config.toml

@@ -1,19 +0,0 @@
-[framework]
-name = "dart"
-
-[main]
-urls.plaintext = "/plaintext"
-urls.json = "/json"
-urls.db = "/db"
-urls.query = "/queries?queries="
-urls.update = "/updates?queries="
-urls.fortune = "/fortunes"
-approach = "Stripped"
-classification = "Platform"
-database = "Postgres"
-database_os = "Linux"
-os = "Linux"
-orm = "Raw"
-platform = "None"
-webserver = "None"
-versus = "dart"

+ 0 - 13
frameworks/Dart/dart/dart.dockerfile

@@ -1,13 +0,0 @@
-FROM google/dart:1.24
-
-WORKDIR /dart_app
-COPY fortunes.mustache fortunes.mustache
-COPY postgresql.yaml postgresql.yaml
-COPY pubspec.yaml pubspec.yaml
-COPY server.dart server.dart
-
-RUN pub upgrade
-
-EXPOSE 8080
-
-CMD ["dart", "server.dart"]

+ 0 - 20
frameworks/Dart/dart/fortunes.mustache

@@ -1,20 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Fortunes</title>
-  </head>
-  <body>
-    <table>
-      <tr>
-        <th>id</th>
-        <th>message</th>
-      </tr>
-      {{#fortunes}}
-      <tr>
-        <td>{{id}}</td>
-        <td>{{message}}</td>
-      </tr>
-      {{/fortunes}}
-    </table>
-  </body>
-</html>

+ 0 - 5
frameworks/Dart/dart/postgresql.yaml

@@ -1,5 +0,0 @@
-host: tfb-database
-port: 5432
-user: benchmarkdbuser
-password: benchmarkdbpass
-database: hello_world

+ 0 - 10
frameworks/Dart/dart/pubspec.yaml

@@ -1,10 +0,0 @@
-name: dartbenchmark
-description: A benchmark of dart
-environment:
-  sdk: '>=1.6.0 <2.0.0'
-dependencies:
-  crypto: 0.9.0
-  mustache: 0.1.8
-  postgresql: 0.2.14
-  system_info: 0.0.16
-  yaml: 2.0.1+1

+ 0 - 228
frameworks/Dart/dart/server.dart

@@ -1,228 +0,0 @@
-import 'dart:async' show Future;
-import 'dart:convert';
-import 'dart:io';
-import 'dart:isolate';
-import 'dart:math' show Random, max;
-import 'package:mustache/mustache.dart' as mustache;
-import 'package:postgresql/postgresql.dart' as pg;
-import 'package:postgresql/postgresql_pool.dart' as pgpool;
-import 'package:system_info/system_info.dart';
-import 'package:yaml/yaml.dart' as yaml;
-
-final _NUM_PROCESSORS = SysInfo.processors.length;
-
-final _encoder = new JsonUtf8Encoder();
-
-void main(List<String> args) {
-  ReceivePort errorPort = new ReceivePort();
-  errorPort.listen((e) => print(e));
-  for (int i = 0; i < _NUM_PROCESSORS; i++) {
-    Isolate.spawn(
-        startInIsolate,
-        [],
-        onError: errorPort.sendPort);
-  }
-}
-
-void startInIsolate(List args) {
-  _startServer();
-}
-
-/// The entity used in the database query and update tests.
-class World {
-  int id;
-
-  int randomnumber;
-
-  World(this.id, this.randomnumber);
-
-  toJson() => {'id': id, 'randomNumber': randomnumber};
-}
-
-/// The entity used in the fortunes test.
-class Fortune implements Comparable<Fortune> {
-  int id;
-  String message;
-
-  Fortune(this.id, this.message);
-
-  int compareTo(Fortune other) => message.compareTo(other.message);
-}
-
-/// The number of rows in the world entity table.
-const _WORLD_TABLE_SIZE = 10000;
-
-/// A random number generator.
-final _RANDOM = new Random();
-
-/// The PostgreSQL connection pool used by all the tests that require database
-/// connectivity.
-pgpool.Pool _connectionPool;
-
-/// The mustache template which is rendered in the fortunes test.
-mustache.Template _fortunesTemplate;
-
-void _startServer() {
-  var dbConnections = max(1, (256 / _NUM_PROCESSORS).floor());
-  Future.wait([
-    HttpServer.bind("0.0.0.0", 8080, shared: true),
-    new File('postgresql.yaml').readAsString().then((config) {
-      _connectionPool = new pgpool.Pool(
-          new pg.Settings.fromMap(yaml.loadYaml(config)).toUri(),
-          min: dbConnections, max: dbConnections);
-      return _connectionPool.start();
-    }),
-    new File('fortunes.mustache').readAsString().then((template) {
-      _fortunesTemplate = mustache.parse(template);
-    })
-  ]).then((List waitResults) {
-    var server = waitResults[0];
-    server.defaultResponseHeaders.clear();
-    server.serverHeader = 'dart';
-    server.listen((request) {
-      switch (request.uri.path) {
-        case '/json':
-          _jsonTest(request);
-          break;
-        case '/db':
-          _dbTest(request);
-          break;
-        case '/queries':
-          _queriesTest(request);
-          break;
-        case '/fortunes':
-          _fortunesTest(request);
-          break;
-        case '/updates':
-          _updatesTest(request);
-          break;
-        case '/plaintext':
-          _plaintextTest(request);
-          break;
-        default:
-          _sendResponse(request, HttpStatus.NOT_FOUND);
-          break;
-      }
-    });
-  });
-}
-
-/// Returns the given [text] parsed as a base 10 integer.  If the text is null
-/// or is an otherwise invalid representation of a base 10 integer, zero is
-/// returned.
-int _parseInt(String text) =>
-    (text == null) ? 0 : int.parse(text, radix: 10, onError: ((_) => 0));
-
-/// Completes the given [request] by writing the [response] with the given
-/// [statusCode] and [type].
-void _sendResponse(HttpRequest request, int statusCode,
-    {ContentType type, List<int> response}) {
-  request.response.statusCode = statusCode;
-  request.response.headers.date = new DateTime.now();
-  if (type != null) {
-    request.response.headers.contentType = type;
-  }
-  if (response != null) {
-    request.response.contentLength = response.length;
-    request.response.add(response);
-  } else {
-    request.response.contentLength = 0;
-  }
-  request.response.close();
-}
-
-/// Completes the given [request] by writing the [response] as HTML.
-void _sendHtml(HttpRequest request, String response) {
-  _sendResponse(request, HttpStatus.OK,
-      type: ContentType.HTML, response: UTF8.encode(response));
-}
-
-/// Completes the given [request] by writing the [response] as JSON.
-void _sendJson(HttpRequest request, Object response) {
-  _sendResponse(request, HttpStatus.OK,
-      type: ContentType.JSON, response: _encoder.convert(response));
-}
-
-/// Completes the given [request] by writing the [response] as plain text.
-void _sendText(HttpRequest request, String response) {
-  _sendResponse(request, HttpStatus.OK,
-      type: ContentType.TEXT, response: UTF8.encode(response));
-}
-
-/// Responds with the JSON test to the [request].
-void _jsonTest(HttpRequest request) {
-  _sendJson(request, {'message': 'Hello, World!'});
-}
-
-Future<World> _queryRandom() {
-  return _connectionPool.connect().then((connection) {
-    return connection.query(
-        'SELECT id, randomnumber FROM world WHERE id = @id;', {
-      'id': _RANDOM.nextInt(_WORLD_TABLE_SIZE) + 1
-    })
-        //
-        // The benchmark's constraints tell us there is exactly one row.
-        //
-        .single.then((row) => new World(row[0], row[1])).whenComplete(() {
-      connection.close();
-    });
-  });
-}
-
-/// Responds with the database query test to the [request].
-void _dbTest(HttpRequest request) {
-  _queryRandom().then((response) => _sendJson(request, response));
-}
-
-/// Responds with the database queries test to the [request].
-void _queriesTest(HttpRequest request) {
-  var queries = _parseInt(request.uri.queryParameters['queries']).clamp(1, 500);
-  Future
-      .wait(new List.generate(queries, (_) => _queryRandom(), growable: false))
-      .then((response) => _sendJson(request, response));
-}
-
-/// Responds with the fortunes test to the [request].
-void _fortunesTest(HttpRequest request) {
-  _connectionPool.connect().then((connection) {
-    return connection
-        .query('SELECT id, message FROM fortune;')
-        .map((row) => new Fortune(row[0], row[1]))
-        .toList()
-        .whenComplete(() {
-      connection.close();
-    });
-  }).then((fortunes) {
-    fortunes.add(new Fortune(0, 'Additional fortune added at request time.'));
-    fortunes.sort();
-    _sendHtml(request, _fortunesTemplate.renderString({
-      'fortunes': fortunes
-          .map((fortune) => {'id': fortune.id, 'message': fortune.message})
-          .toList()
-    }));
-  });
-}
-
-/// Responds with the updates test to the [request].
-void _updatesTest(HttpRequest request) {
-  var queries = _parseInt(request.uri.queryParameters['queries']).clamp(1, 500);
-  Future.wait(new List.generate(queries, (_) {
-    return _queryRandom().then((world) {
-      world.randomnumber = _RANDOM.nextInt(_WORLD_TABLE_SIZE) + 1;
-      return _connectionPool.connect().then((connection) {
-        return connection
-            .execute(
-                'UPDATE world SET randomnumber = @randomnumber WHERE id = @id;',
-                {'randomnumber': world.randomnumber, 'id': world.id})
-            .whenComplete(() {
-          connection.close();
-        });
-      }).then((_) => world);
-    });
-  }, growable: false)).then((worlds) => _sendJson(request, worlds));
-}
-
-/// Responds with the plaintext test to the [request].
-void _plaintextTest(HttpRequest request) {
-  _sendText(request, 'Hello, World!');
-}