Revert "It's time to #deleteDart1 (#18293)" (#18313)

Several benchmarks started failing during kernel compile:
1. Timeouts:
   * commands_test
   * hot_mode_dev_cycle__benchmark
   * run_machine_concurrent_hot_reload
   * service_extensions_test

2. Kernel compiler crash:
   * hot_mode_dev_cycle_linux__benchmark
   * routing_test

3. Unexpected termination:
   * hot_mode_dev_cycle_win__benchmark

This reverts commit ed63e7082a.
This commit is contained in:
Chris Bracken
2018-06-08 12:43:11 -07:00
committed by GitHub
parent ed63e7082a
commit 9495df4bc3
45 changed files with 873 additions and 220 deletions

View File

@@ -68,8 +68,12 @@ Future<Null> _generateDocs() async {
}
Future<Null> _verifyInternationalizations() async {
final EvalResult genResult = await _evalCommand(dart,
<String>[ '--preview-dart-2', path.join('dev', 'tools', 'gen_localizations.dart'), ],
final EvalResult genResult = await _evalCommand(
dart,
<String>[
'--preview-dart-2',
path.join('dev', 'tools', 'gen_localizations.dart'),
],
workingDirectory: flutterRoot,
);

View File

@@ -32,6 +32,14 @@ void main() async {
return new TaskResult.failure(errorMessage);
}
section('gradlew assembleDebug no-preview-dart-2');
await project.runGradleTask('assembleDebug', options: <String>['-Ppreview-dart-2=false']);
errorMessage = _validateSnapshotDependency(project,
'${project.rootPath}/build/app/intermediates/flutter/debug/snapshot_blob.bin');
if (errorMessage != null) {
return new TaskResult.failure(errorMessage);
}
section('gradlew assembleProfile');
await project.runGradleTask('assembleProfile');

View File

@@ -0,0 +1,12 @@
// Copyright (c) 2017 The Chromium Authors. 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:async';
import 'package:flutter_devicelab/tasks/hot_mode_tests.dart';
import 'package:flutter_devicelab/framework/framework.dart';
Future<Null> main() async {
await task(createHotModeTest(isPreviewDart2: false));
}

View File

@@ -0,0 +1,14 @@
// Copyright (c) 2018 The Chromium Authors. 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:async';
import 'package:flutter_devicelab/tasks/hot_mode_tests.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/adb.dart';
Future<Null> main() async {
deviceOperatingSystem = DeviceOperatingSystem.ios;
await task(createHotModeTest(isPreviewDart2: false));
}

View File

@@ -16,7 +16,7 @@ import '../framework/utils.dart';
final Directory _editedFlutterGalleryDir = dir(path.join(Directory.systemTemp.path, 'edited_flutter_gallery'));
final Directory flutterGalleryDir = dir(path.join(flutterDirectory.path, 'examples/flutter_gallery'));
TaskFunction createHotModeTest() {
TaskFunction createHotModeTest({ bool isPreviewDart2 = true }) {
return () async {
final Device device = await devices.workingDevice;
await device.unlock();
@@ -25,6 +25,10 @@ TaskFunction createHotModeTest() {
final List<String> options = <String>[
'--hot', '-d', device.deviceId, '--benchmark', '--verbose', '--resident'
];
if (isPreviewDart2)
options.add('--preview-dart-2');
else
options.add('--no-preview-dart-2');
setLocalEngineOptionIfNecessary(options);
int hotReloadCount = 0;
Map<String, dynamic> twoReloadsData;
@@ -88,8 +92,8 @@ TaskFunction createHotModeTest() {
}
benchmarkFile.deleteSync();
// start `flutter run` again to make sure it loads from the previous
// state; frontend loads up from previously generated kernel files.
// start `flutter run` again to make sure it loads from the previous state
// (in case of --preview-dart-2 frontend loads up from previously generated kernel files).
{
final Process process = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'),

View File

@@ -23,7 +23,7 @@ TaskFunction createMicrobenchmarkTask() {
final Device device = await devices.workingDevice;
await device.unlock();
Future<Map<String, double>> _runMicrobench(String benchmarkPath) async {
Future<Map<String, double>> _runMicrobench(String benchmarkPath, {bool previewDart2 = true}) async {
Future<Map<String, double>> _run() async {
print('Running $benchmarkPath');
final Directory appDir = dir(
@@ -38,6 +38,10 @@ TaskFunction createMicrobenchmarkTask() {
'-d',
device.deviceId,
];
if (previewDart2)
options.add('--preview-dart-2');
else
options.add('--no-preview-dart-2');
setLocalEngineOptionIfNecessary(options);
options.add(benchmarkPath);
return await _startFlutter(
@@ -57,6 +61,26 @@ TaskFunction createMicrobenchmarkTask() {
allResults.addAll(await _runMicrobench('lib/gestures/velocity_tracker_bench.dart'));
allResults.addAll(await _runMicrobench('lib/stocks/animation_bench.dart'));
// Run micro-benchmarks once again in --no-preview-dart-2 mode.
// Append "_dart1" suffix to the result keys to distinguish them from
// the original results.
void addDart1Results(Map<String, double> benchmarkResults) {
benchmarkResults.forEach((String key, double result) {
allResults[key + '_dart1'] = result;
});
}
addDart1Results(await _runMicrobench(
'lib/stocks/layout_bench.dart', previewDart2: false));
addDart1Results(await _runMicrobench(
'lib/stocks/layout_bench.dart', previewDart2: false));
addDart1Results(await _runMicrobench(
'lib/stocks/build_bench.dart', previewDart2: false));
addDart1Results(await _runMicrobench(
'lib/gestures/velocity_tracker_bench.dart', previewDart2: false));
addDart1Results(await _runMicrobench(
'lib/stocks/animation_bench.dart', previewDart2: false));
return new TaskResult.success(allResults, benchmarkScoreKeys: allResults.keys.toList());
};
}

View File

@@ -205,13 +205,23 @@ class CompileTest {
final Map<String, dynamic> metrics = <String, dynamic>{}
..addAll(await _compileAot())
..addAll(await _compileApp())
..addAll(await _compileDebug());
..addAll(await _compileDebug())
..addAll(_suffix(await _compileAot(previewDart2: false), '__dart1'))
..addAll(_suffix(await _compileApp(previewDart2: false), '__dart1'))
..addAll(_suffix(await _compileDebug(previewDart2: false), '__dart1'));
return new TaskResult.success(metrics, benchmarkScoreKeys: metrics.keys.toList());
});
}
static Future<Map<String, dynamic>> _compileAot() async {
static Map<String, dynamic> _suffix(Map<String, dynamic> map, String suffix) {
return new Map<String, dynamic>.fromIterables(
map.keys.map<String>((String key) => '$key$suffix'),
map.values,
);
}
static Future<Map<String, dynamic>> _compileAot({ bool previewDart2 = true }) async {
// Generate blobs instead of assembly.
await flutter('clean');
final Stopwatch watch = new Stopwatch()..start();
@@ -230,6 +240,10 @@ class CompileTest {
options.add('android-arm');
break;
}
if (previewDart2)
options.add('--preview-dart-2');
else
options.add('--no-preview-dart-2');
setLocalEngineOptionIfNecessary(options);
final String compileLog = await evalFlutter('build', options: options);
watch.stop();
@@ -244,11 +258,15 @@ class CompileTest {
return metrics;
}
static Future<Map<String, dynamic>> _compileApp() async {
static Future<Map<String, dynamic>> _compileApp({ bool previewDart2 = true }) async {
await flutter('clean');
final Stopwatch watch = new Stopwatch();
int releaseSizeInBytes;
final List<String> options = <String>['--release'];
if (previewDart2)
options.add('--preview-dart-2');
else
options.add('--no-preview-dart-2');
setLocalEngineOptionIfNecessary(options);
switch (deviceOperatingSystem) {
case DeviceOperatingSystem.ios:
@@ -281,10 +299,14 @@ class CompileTest {
};
}
static Future<Map<String, dynamic>> _compileDebug() async {
static Future<Map<String, dynamic>> _compileDebug({ bool previewDart2 = true }) async {
await flutter('clean');
final Stopwatch watch = new Stopwatch();
final List<String> options = <String>['--debug'];
if (previewDart2)
options.add('--preview-dart-2');
else
options.add('--no-preview-dart-2');
setLocalEngineOptionIfNecessary(options);
switch (deviceOperatingSystem) {
case DeviceOperatingSystem.ios:

View File

@@ -154,6 +154,21 @@ tasks:
stage: devicelab
required_agent_capabilities: ["mac/android"]
hot_mode_dev_cycle__benchmark_dart1:
description: >
Measures the performance of Dart VM hot patching feature under
--no-preview-dart-2 option, that disables Dart 2.0 frontend.
stage: devicelab
required_agent_capabilities: ["mac/android"]
hot_mode_dev_cycle_ios__benchmark_dart1:
description: >
Measures the performance of Dart VM hot patching feature under
--no-preview-dart-2 option, that disables Dart 2.0 frontend.
stage: devicelab_ios
required_agent_capabilities: ["mac/ios"]
flaky: true
complex_layout_scroll_perf__memory:
description: >
Measures memory usage of the scroll performance test.