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,27 +191,58 @@ class BuildTest {
await device.unlock();
await flutter('packages', options: <String>['get']);
final Map<String, dynamic> aotResults = await _buildAot();
final Map<String, dynamic> debugResults = await _buildDebug();
final Map<String, dynamic> metrics = <String, dynamic>{}
..addAll(aotResults)
..addAll(debugResults);
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',
'--profile',
'--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> data = new Map<String, dynamic>.fromIterable(
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)),
);
data['aot_snapshot_build_millis'] = watch.elapsedMilliseconds;
metrics['aot_snapshot_build_millis'] = watch.elapsedMilliseconds;
return new TaskResult.success(data, benchmarkScoreKeys: data.keys.toList());
});
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) {
......
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