Benchmark for semantic overhead during transitions (#10678) * Benchmark for semantic overhead during transitions * review comments
diff --git a/dev/devicelab/bin/tasks/flutter_gallery__transition_perf_with_semantics.dart b/dev/devicelab/bin/tasks/flutter_gallery__transition_perf_with_semantics.dart new file mode 100644 index 0000000..27c6171 --- /dev/null +++ b/dev/devicelab/bin/tasks/flutter_gallery__transition_perf_with_semantics.dart
@@ -0,0 +1,29 @@ +// Copyright 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/gallery.dart'; +import 'package:flutter_devicelab/framework/adb.dart'; +import 'package:flutter_devicelab/framework/framework.dart'; + +Future<Null> main() async { + deviceOperatingSystem = DeviceOperatingSystem.android; + await task(() async { + final TaskResult withoutSemantics = await createGalleryTransitionTest()(); + final TaskResult withSemantics = await createGalleryTransitionTest(semanticsEnabled: true)(); + + final List<String> benchmarkScoreKeys = <String>[]; + final Map<String, dynamic> data = <String, dynamic>{}; + for (String key in withSemantics.benchmarkScoreKeys) { + final String deltaKey = 'delta_$key'; + data[deltaKey] = withSemantics.data[key] - withoutSemantics.data[key]; + data['semantics_$key'] = withSemantics.data[key]; + data[key] = withoutSemantics.data[key]; + benchmarkScoreKeys.add(deltaKey); + } + + return new TaskResult.success(data, benchmarkScoreKeys: benchmarkScoreKeys); + }); +}
diff --git a/dev/devicelab/lib/tasks/gallery.dart b/dev/devicelab/lib/tasks/gallery.dart index 6a36e00..b073003 100644 --- a/dev/devicelab/lib/tasks/gallery.dart +++ b/dev/devicelab/lib/tasks/gallery.dart
@@ -12,12 +12,16 @@ import '../framework/ios.dart'; import '../framework/utils.dart'; -TaskFunction createGalleryTransitionTest() { - return new GalleryTransitionTest(); +TaskFunction createGalleryTransitionTest({ bool semanticsEnabled: false }) { + return new GalleryTransitionTest(semanticsEnabled: semanticsEnabled); } class GalleryTransitionTest { + GalleryTransitionTest({ this.semanticsEnabled: false }); + + final bool semanticsEnabled; + Future<TaskResult> call() async { final Device device = await devices.workingDevice; await device.unlock(); @@ -33,11 +37,15 @@ await flutter('build', options: <String>['ios', '--profile']); } + final String testDriver = semanticsEnabled + ? 'transitions_perf_with_semantics.dart' + : 'transitions_perf.dart'; + await flutter('drive', options: <String>[ '--profile', '--trace-startup', '-t', - 'test_driver/transitions_perf.dart', + 'test_driver/$testDriver', '-d', deviceId, ]);
diff --git a/dev/devicelab/manifest.yaml b/dev/devicelab/manifest.yaml index a67b889..a8fab3f 100644 --- a/dev/devicelab/manifest.yaml +++ b/dev/devicelab/manifest.yaml
@@ -274,6 +274,14 @@ stage: devicelab required_agent_capabilities: ["linux/android"] + flutter_gallery__transition_perf_with_semantics: + description: > + Measures the delta in performance of screen transitions without and + with semantics enabled. + stage: devicelab + required_agent_capabilities: ["linux/android"] + flaky: true + flutter_gallery__memory_nav: description: > Measures memory usage after repeated navigation in Gallery.