mirror of
https://github.com/dart-lang/sdk
synced 2024-07-01 07:14:29 +00:00
[ Benchmarks ] Add benchmarks for SDK snapshot sizes and Dart CLI
startup time Change-Id: If0c792036ac377aa3d777f95816e9d1d548326b1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201167 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Ben Konyi <bkonyi@google.com>
This commit is contained in:
parent
1a8410d44c
commit
7767e6acc1
21
benchmarks/DartCLIStartup/dart/DartCLIStartup.dart
Normal file
21
benchmarks/DartCLIStartup/dart/DartCLIStartup.dart
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:benchmark_harness/benchmark_harness.dart';
|
||||
|
||||
class DartCLIStartup extends BenchmarkBase {
|
||||
const DartCLIStartup() : super('DartCLIStartup');
|
||||
|
||||
// The benchmark code.
|
||||
@override
|
||||
void run() {
|
||||
Process.runSync(Platform.executable, ['help']);
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
const DartCLIStartup().report();
|
||||
}
|
23
benchmarks/DartCLIStartup/dart2/DartCLIStartup.dart
Normal file
23
benchmarks/DartCLIStartup/dart2/DartCLIStartup.dart
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// @dart=2.9
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:benchmark_harness/benchmark_harness.dart';
|
||||
|
||||
class DartCLIStartup extends BenchmarkBase {
|
||||
const DartCLIStartup() : super('DartCLIStartup');
|
||||
|
||||
// The benchmark code.
|
||||
@override
|
||||
void run() {
|
||||
Process.runSync(Platform.executable, ['help']);
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
const DartCLIStartup().report();
|
||||
}
|
61
benchmarks/SDKArtifactSizes/dart/SDKArtifactSizes.dart
Normal file
61
benchmarks/SDKArtifactSizes/dart/SDKArtifactSizes.dart
Normal file
|
@ -0,0 +1,61 @@
|
|||
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// Reports the sizes of binary artifacts shipped with the SDK.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
const executables = <String>[
|
||||
'dart',
|
||||
'dartaotruntime',
|
||||
];
|
||||
|
||||
const libs = <String>[
|
||||
'vm_platform_strong.dill',
|
||||
'vm_platform_strong_product.dill',
|
||||
];
|
||||
|
||||
const snapshots = <String>[
|
||||
'analysis_server',
|
||||
'dart2js',
|
||||
'dart2native',
|
||||
'dartanalyzer',
|
||||
'dartdev',
|
||||
'dartdevc',
|
||||
'dartdoc',
|
||||
'dartfmt',
|
||||
'dds',
|
||||
'frontend_server',
|
||||
'gen_kernel',
|
||||
'kernel-service',
|
||||
'kernel_worker',
|
||||
'pub',
|
||||
];
|
||||
|
||||
Future<void> reportArtifactSize(String path, String name) async {
|
||||
final size = await File(path).length();
|
||||
print('SDKArtifactSize_$name(CodeSize): $size');
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
final topDirIndex =
|
||||
Platform.resolvedExecutable.lastIndexOf(Platform.pathSeparator);
|
||||
final rootDir = Platform.resolvedExecutable.substring(0, topDirIndex);
|
||||
|
||||
for (final executable in executables) {
|
||||
final executablePath = '$rootDir/dart-sdk/bin/$executable';
|
||||
await reportArtifactSize(executablePath, executable);
|
||||
}
|
||||
|
||||
for (final lib in libs) {
|
||||
final libPath = '$rootDir/dart-sdk/lib/_internal/$lib';
|
||||
await reportArtifactSize(libPath, lib);
|
||||
}
|
||||
|
||||
for (final snapshot in snapshots) {
|
||||
final snapshotPath =
|
||||
'$rootDir/dart-sdk/bin/snapshots/$snapshot.dart.snapshot';
|
||||
await reportArtifactSize(snapshotPath, snapshot);
|
||||
}
|
||||
}
|
61
benchmarks/SDKArtifactSizes/dart2/SDKArtifactSizes.dart
Normal file
61
benchmarks/SDKArtifactSizes/dart2/SDKArtifactSizes.dart
Normal file
|
@ -0,0 +1,61 @@
|
|||
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// Reports the sizes of binary artifacts shipped with the SDK.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
const executables = <String>[
|
||||
'dart',
|
||||
'dartaotruntime',
|
||||
];
|
||||
|
||||
const libs = <String>[
|
||||
'vm_platform_strong.dill',
|
||||
'vm_platform_strong_product.dill',
|
||||
];
|
||||
|
||||
const snapshots = <String>[
|
||||
'analysis_server',
|
||||
'dart2js',
|
||||
'dart2native',
|
||||
'dartanalyzer',
|
||||
'dartdev',
|
||||
'dartdevc',
|
||||
'dartdoc',
|
||||
'dartfmt',
|
||||
'dds',
|
||||
'frontend_server',
|
||||
'gen_kernel',
|
||||
'kernel-service',
|
||||
'kernel_worker',
|
||||
'pub',
|
||||
];
|
||||
|
||||
Future<void> reportArtifactSize(String path, String name) async {
|
||||
final size = await File(path).length();
|
||||
print('SDKArtifactSize_$name(CodeSize): $size');
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
final topDirIndex =
|
||||
Platform.resolvedExecutable.lastIndexOf(Platform.pathSeparator);
|
||||
final rootDir = Platform.resolvedExecutable.substring(0, topDirIndex);
|
||||
|
||||
for (final executable in executables) {
|
||||
final executablePath = '$rootDir/dart-sdk/bin/$executable';
|
||||
await reportArtifactSize(executablePath, executable);
|
||||
}
|
||||
|
||||
for (final lib in libs) {
|
||||
final libPath = '$rootDir/dart-sdk/lib/_internal/$lib';
|
||||
await reportArtifactSize(libPath, lib);
|
||||
}
|
||||
|
||||
for (final snapshot in snapshots) {
|
||||
final snapshotPath =
|
||||
'$rootDir/dart-sdk/bin/snapshots/$snapshot.dart.snapshot';
|
||||
await reportArtifactSize(snapshotPath, snapshot);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user