Commit f59a6770 authored by yjbanov's avatar yjbanov Committed by Yegor

track debug build times; switch from --profile to --release

parent 307f3569
......@@ -177,6 +177,8 @@ class PerfTest {
}
}
/// Measures how long it takes to build a Flutter app and how big the compiled
/// code is.
class BuildTest {
BuildTest(this.testDirectory);
......@@ -189,29 +191,60 @@ class BuildTest {
await device.unlock();
await flutter('packages', options: <String>['get']);
final Stopwatch watch = new Stopwatch()..start();
final String buildLog = await evalFlutter('build', options: <String>[
'aot',
'-v',
'--profile',
'--no-pub',
'--target-platform', 'android-arm' // Generate blobs instead of assembly.
]);
watch.stop();
final Map<String, dynamic> aotResults = await _buildAot();
final Map<String, dynamic> debugResults = await _buildDebug();
final RegExp metricExpression = new RegExp(r'([a-zA-Z]+)\(CodeSize\)\: (\d+)');
final Map<String, dynamic> metrics = <String, dynamic>{}
..addAll(aotResults)
..addAll(debugResults);
final Map<String, dynamic> data = new Map<String, dynamic>.fromIterable(
metricExpression.allMatches(buildLog),
key: (Match m) => _sdkNameToMetricName(m.group(1)),
value: (Match m) => int.parse(m.group(2)),
);
data['aot_snapshot_build_millis'] = watch.elapsedMilliseconds;
return new TaskResult.success(data, benchmarkScoreKeys: data.keys.toList());
return new TaskResult.success(metrics, benchmarkScoreKeys: metrics.keys.toList());
});
}
static Future<Map<String, dynamic>> _buildAot() async {
await flutter('build', options: <String>['clean']);
final Stopwatch watch = new Stopwatch()..start();
final String buildLog = await evalFlutter('build', options: <String>[
'aot',
'-v',
'--release',
'--no-pub',
'--target-platform', 'android-arm' // Generate blobs instead of assembly.
]);
watch.stop();
final RegExp metricExpression = new RegExp(r'([a-zA-Z]+)\(CodeSize\)\: (\d+)');
final Map<String, dynamic> metrics = new Map<String, dynamic>.fromIterable(
metricExpression.allMatches(buildLog),
key: (Match m) => _sdkNameToMetricName(m.group(1)),
value: (Match m) => int.parse(m.group(2)),
);
metrics['aot_snapshot_build_millis'] = watch.elapsedMilliseconds;
return metrics;
}
static Future<Map<String, dynamic>> _buildDebug() async {
await flutter('build', options: <String>['clean']);
final Stopwatch watch = new Stopwatch();
if (deviceOperatingSystem == DeviceOperatingSystem.ios) {
await prepareProvisioningCertificates(cwd);
watch.start();
await flutter('build', options: <String>['ios', '--debug']);
watch.stop();
} else {
watch.start();
await flutter('build', options: <String>['apk', '--debug']);
watch.stop();
}
return <String, dynamic>{
'debug_full_build_millis': watch.elapsedMilliseconds,
};
}
static String _sdkNameToMetricName(String sdkName) {
const Map<String, String> kSdkNameToMetricNameMapping = const <String, String> {
'VMIsolate': 'aot_snapshot_size_vmisolate',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment