Add a benchmark for simple DisplayLists to exercise the Raster Cache's cache admission algorithm (#97992)

This commit is contained in:
George Wright 2022-02-07 21:01:01 -08:00 committed by GitHub
parent e8393757c7
commit ff1e9b7b9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 131 additions and 0 deletions

View File

@ -2062,6 +2062,17 @@ targets:
task_name: picture_cache_perf__timeline_summary
scheduler: luci
- name: Linux_android picture_cache_complexity_scoring_perf__timeline_summary
recipe: devicelab/devicelab_drone
bringup: true
presubmit: false
timeout: 60
properties:
tags: >
["devicelab","android","linux"]
task_name: picture_cache_complexity_scoring_perf__timeline_summary
scheduler: luci
- name: Linux_android platform_channels_benchmarks
recipe: devicelab/devicelab_drone
presubmit: false
@ -3371,6 +3382,17 @@ targets:
task_name: new_gallery_ios__transition_perf
scheduler: luci
- name: Mac_ios picture_cache_complexity_scoring_perf__timeline_summary
recipe: devicelab/devicelab_drone
bringup: true
presubmit: false
timeout: 60
properties:
tags: >
["devicelab","ios","mac"]
task_name: picture_cache_complexity_scoring_perf__timeline_summary
scheduler: luci
- name: Mac_ios platform_channel_sample_test_ios
recipe: devicelab/devicelab_drone
presubmit: false

View File

@ -113,6 +113,7 @@
/dev/devicelab/bin/tasks/microbenchmarks.dart @zanderso @flutter/engine
/dev/devicelab/bin/tasks/new_gallery__transition_perf.dart @zanderso @flutter/engine
/dev/devicelab/bin/tasks/picture_cache_perf__timeline_summary.dart @zanderso @flutter/engine
/dev/devicelab/bin/tasks/picture_cache_complexity_scoring_perf__timeline_summary.dart @flar @flutter/engine
/dev/devicelab/bin/tasks/platform_channel_sample_test.dart @zanderso @flutter/engine
/dev/devicelab/bin/tasks/platform_interaction_test.dart @stuartmorgan @flutter/plugin
/dev/devicelab/bin/tasks/platform_view__start_up.dart @zanderso @flutter/engine

View File

@ -8,6 +8,7 @@ const String kBackdropFilterRouteName = '/backdrop_filter';
const String kPostBackdropFilterRouteName = '/post_backdrop_filter';
const String kSimpleAnimationRouteName = '/simple_animation';
const String kPictureCacheRouteName = '/picture_cache';
const String kPictureCacheComplexityScoringRouteName = '/picture_cache_complexity_scoring';
const String kLargeImageChangerRouteName = '/large_image_changer';
const String kLargeImagesRouteName = '/large_images';
const String kTextRouteName = '/text';

View File

@ -21,6 +21,7 @@ import 'src/large_images.dart';
import 'src/multi_widget_construction.dart';
import 'src/opacity_peephole.dart';
import 'src/picture_cache.dart';
import 'src/picture_cache_complexity_scoring.dart';
import 'src/post_backdrop_filter.dart';
import 'src/simple_animation.dart';
import 'src/simple_scroll.dart';
@ -47,6 +48,7 @@ class MacrobenchmarksApp extends StatelessWidget {
kPostBackdropFilterRouteName: (BuildContext context) => const PostBackdropFilterPage(),
kSimpleAnimationRouteName: (BuildContext context) => const SimpleAnimationPage(),
kPictureCacheRouteName: (BuildContext context) => const PictureCachePage(),
kPictureCacheComplexityScoringRouteName: (BuildContext context) => const PictureCacheComplexityScoringPage(),
kLargeImageChangerRouteName: (BuildContext context) => const LargeImageChangerPage(),
kLargeImagesRouteName: (BuildContext context) => const LargeImagesPage(),
kTextRouteName: (BuildContext context) => const TextPage(),
@ -122,6 +124,13 @@ class HomePage extends StatelessWidget {
Navigator.pushNamed(context, kPictureCacheRouteName);
},
),
ElevatedButton(
key: const Key(kPictureCacheComplexityScoringRouteName),
child: const Text('Picture Cache Complexity Scoring'),
onPressed: () {
Navigator.pushNamed(context, kPictureCacheComplexityScoringRouteName);
},
),
ElevatedButton(
key: const Key(kLargeImagesRouteName),
child: const Text('Large Images'),

View File

@ -0,0 +1,47 @@
// Copyright 2014 The Flutter 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 'package:flutter/material.dart';
class PictureCacheComplexityScoringPage extends StatelessWidget {
const PictureCacheComplexityScoringPage({Key? key}) : super(key: key);
static const List<String> kTabNames = <String>['1', '2'];
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: kTabNames.length, // This is the number of tabs.
child: Scaffold(
appBar: AppBar(
title: const Text('Picture Cache Complexity Scoring'),
// pinned: true,
// expandedHeight: 50.0,
// forceElevated: innerBoxIsScrolled,
bottom: TabBar(
tabs: kTabNames.map((String name) => Tab(text: name)).toList(),
),
),
body: TabBarView(
key: const Key('tabbar_view_complexity'), // this key is used by the driver test
children: kTabNames.map((String name) {
return _buildComplexityScoringWidgets(name);
}).toList(),
),
),
);
}
// For now we just test a single case where the widget being cached is actually
// relatively cheap to rasterise, and so should not be in the cache.
//
// Eventually we can extend this to add new test cases based on the tab name.
Widget _buildComplexityScoringWidgets(String name) {
return Column(children: <Widget>[
Slider(value: 50, label: 'Slider 1', onChanged: (double _) {}, max: 100, divisions: 10,),
Slider(value: 50, label: 'Slider 2', onChanged: (double _) {}, max: 100, divisions: 10,),
Slider(value: 50, label: 'Slider 3', onChanged: (double _) {}, max: 100, divisions: 10,),
]);
}
}

View File

@ -0,0 +1,30 @@
// Copyright 2014 The Flutter 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 'package:flutter_driver/flutter_driver.dart';
import 'package:macrobenchmarks/common.dart';
import 'util.dart';
void main() {
macroPerfTest(
'picture_cache_complexity_scoring_perf',
kPictureCacheComplexityScoringRouteName,
pageDelay: const Duration(seconds: 1),
driverOps: (FlutterDriver driver) async {
final SerializableFinder tabBarView = find.byValueKey('tabbar_view_complexity');
Future<void> _scrollOnce(double offset) async {
// Technically it's not scrolling but moving
await driver.scroll(tabBarView, offset, 0.0, const Duration(milliseconds: 300));
await Future<void>.delayed(const Duration(milliseconds: 500));
}
// When we eventually add more test panes we will want to tweak these
// to go through all the panes
for (int i = 0; i < 6; i += 1) {
await _scrollOnce(-300.0);
await _scrollOnce(300.0);
}
},
);
}

View File

@ -0,0 +1,12 @@
// Copyright 2014 The Flutter 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 'package:flutter_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/tasks/perf_tests.dart';
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.android;
await task(createPictureCacheComplexityScoringPerfTest());
}

View File

@ -215,6 +215,15 @@ TaskFunction createPictureCachePerfE2ETest() {
).run;
}
TaskFunction createPictureCacheComplexityScoringPerfTest() {
return PerfTest(
'${flutterDirectory.path}/dev/benchmarks/macrobenchmarks',
'test_driver/run_app.dart',
'picture_cache_complexity_scoring_perf',
testDriver: 'test_driver/picture_cache_complexity_scoring_perf_test.dart',
).run;
}
TaskFunction createFlutterGalleryStartupTest({String target = 'lib/main.dart'}) {
return StartupTest(
'${flutterDirectory.path}/dev/integration_tests/flutter_gallery',