Skip to content

Commit

Permalink
Report CompileTime metric in flutter build aot --report-timings. (#31895
Browse files Browse the repository at this point in the history
)

This is the correct metric to report for compilation time benchmarks rather
than RunTime. Rename the 'gen_snapshot' value to merely 'snapshot' for
backwards compatibility and overall simplicity.

This change simplifies Dart's benchmarking of Flutter by making it easier to
adopt --report-timings (made for Dart to use), which makes the benchmarks
much more robust.
  • Loading branch information
sortie authored and mraleph committed May 2, 2019
1 parent b702d5a commit 8b9eb3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/flutter_tools/lib/src/base/build.dart
Expand Up @@ -203,7 +203,7 @@ class AOTSnapshotter {
// }

final SnapshotType snapshotType = SnapshotType(platform, buildMode);
final int genSnapshotExitCode = await _timedStep('gen_snapshot', () => genSnapshot.run(
final int genSnapshotExitCode = await _timedStep('snapshot(CompileTime)', () => genSnapshot.run(
snapshotType: snapshotType,
additionalArgs: genSnapshotArgs,
iosArch: iosArch,
Expand Down Expand Up @@ -315,7 +315,7 @@ class AOTSnapshotter {

final String depfilePath = fs.path.join(outputPath, 'kernel_compile.d');
final KernelCompiler kernelCompiler = await kernelCompilerFactory.create(flutterProject);
final CompilerOutput compilerOutput = await _timedStep('frontend', () => kernelCompiler.compile(
final CompilerOutput compilerOutput = await _timedStep('frontend(CompileTime)', () => kernelCompiler.compile(
sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath, mode: buildMode),
mainPath: mainPath,
packagesPath: packagesPath,
Expand Down Expand Up @@ -361,7 +361,7 @@ class AOTSnapshotter {
final Stopwatch sw = Stopwatch()..start();
final T value = await action();
if (reportTimings) {
printStatus('$marker(RunTime): ${sw.elapsedMilliseconds} ms.');
printStatus('$marker: ${sw.elapsedMilliseconds} ms.');
}
return value;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_tools/test/base/build_test.dart
Expand Up @@ -525,7 +525,7 @@ void main() {

expect(genSnapshotExitCode, 0);
expect(genSnapshot.callCount, 1);
expect(bufferLogger.statusText, matches(RegExp(r'gen_snapshot\(RunTime\): \d+ ms.')));
expect(bufferLogger.statusText, matches(RegExp(r'snapshot\(CompileTime\): \d+ ms.')));
}, overrides: contextOverrides);
});

Expand Down

0 comments on commit 8b9eb3e

Please sign in to comment.