Commit e2d4f924 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Benchmark for semantic overhead during transitions (#10678)

* Benchmark for semantic overhead during transitions

* review comments
parent 7158646b
// 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);
});
}
...@@ -12,12 +12,16 @@ import '../framework/framework.dart'; ...@@ -12,12 +12,16 @@ import '../framework/framework.dart';
import '../framework/ios.dart'; import '../framework/ios.dart';
import '../framework/utils.dart'; import '../framework/utils.dart';
TaskFunction createGalleryTransitionTest() { TaskFunction createGalleryTransitionTest({ bool semanticsEnabled: false }) {
return new GalleryTransitionTest(); return new GalleryTransitionTest(semanticsEnabled: semanticsEnabled);
} }
class GalleryTransitionTest { class GalleryTransitionTest {
GalleryTransitionTest({ this.semanticsEnabled: false });
final bool semanticsEnabled;
Future<TaskResult> call() async { Future<TaskResult> call() async {
final Device device = await devices.workingDevice; final Device device = await devices.workingDevice;
await device.unlock(); await device.unlock();
...@@ -33,11 +37,15 @@ class GalleryTransitionTest { ...@@ -33,11 +37,15 @@ class GalleryTransitionTest {
await flutter('build', options: <String>['ios', '--profile']); await flutter('build', options: <String>['ios', '--profile']);
} }
final String testDriver = semanticsEnabled
? 'transitions_perf_with_semantics.dart'
: 'transitions_perf.dart';
await flutter('drive', options: <String>[ await flutter('drive', options: <String>[
'--profile', '--profile',
'--trace-startup', '--trace-startup',
'-t', '-t',
'test_driver/transitions_perf.dart', 'test_driver/$testDriver',
'-d', '-d',
deviceId, deviceId,
]); ]);
......
...@@ -274,6 +274,14 @@ tasks: ...@@ -274,6 +274,14 @@ tasks:
stage: devicelab stage: devicelab
required_agent_capabilities: ["linux/android"] 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: flutter_gallery__memory_nav:
description: > description: >
Measures memory usage after repeated navigation in Gallery. Measures memory usage after repeated navigation in Gallery.
......
...@@ -174,11 +174,15 @@ Future<Null> runDemos(Iterable<Demo> demos, FlutterDriver driver) async { ...@@ -174,11 +174,15 @@ Future<Null> runDemos(Iterable<Demo> demos, FlutterDriver driver) async {
} }
} }
void main() { void main(List<String> args) {
group('flutter gallery transitions', () { group('flutter gallery transitions', () {
FlutterDriver driver; FlutterDriver driver;
setUpAll(() async { setUpAll(() async {
driver = await FlutterDriver.connect(); driver = await FlutterDriver.connect();
if (args.contains('--with_semantics')) {
print('Enabeling semantics...');
await driver.setSemantics(true);
}
}); });
tearDownAll(() async { tearDownAll(() async {
......
// 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 'transitions_perf.dart' as transitions_perf;
void main() {
transitions_perf.main();
}
// 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 'transitions_perf_test.dart' as transitions_perf_test;
void main() {
transitions_perf_test.main(<String>['--with_semantics']);
}
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