Benchmark for semantic overhead during transitions (#10678)
* Benchmark for semantic overhead during transitions * review comments
This commit is contained in:
parent
7158646ba7
commit
e2d4f9242e
@ -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);
|
||||
});
|
||||
}
|
@ -12,12 +12,16 @@ import '../framework/framework.dart';
|
||||
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 @@ class GalleryTransitionTest {
|
||||
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,
|
||||
]);
|
||||
|
@ -274,6 +274,14 @@ tasks:
|
||||
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.
|
||||
|
@ -174,11 +174,15 @@ Future<Null> runDemos(Iterable<Demo> demos, FlutterDriver driver) async {
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
void main(List<String> args) {
|
||||
group('flutter gallery transitions', () {
|
||||
FlutterDriver driver;
|
||||
setUpAll(() async {
|
||||
driver = await FlutterDriver.connect();
|
||||
if (args.contains('--with_semantics')) {
|
||||
print('Enabeling semantics...');
|
||||
await driver.setSemantics(true);
|
||||
}
|
||||
});
|
||||
|
||||
tearDownAll(() async {
|
||||
|
@ -0,0 +1,9 @@
|
||||
// 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();
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
// 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']);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user