Skip to content

Commit 54dbbd7

Browse files
[devicelab] add regular old blur benchmark (#123879)
[devicelab] add regular old blur benchmark
1 parent db5434e commit 54dbbd7

10 files changed

+174
-2
lines changed

.ci.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2439,6 +2439,16 @@ targets:
24392439
["devicelab", "android", "linux"]
24402440
task_name: android_choreographer_do_frame_test
24412441

2442+
- name: Linux_android animated_blur_backdrop_filter_perf__timeline_summary
2443+
recipe: devicelab/devicelab_drone
2444+
presubmit: false
2445+
timeout: 60
2446+
bringup: true
2447+
properties:
2448+
tags: >
2449+
["devicelab", "android", "linux"]
2450+
task_name: animated_blur_backdrop_filter_perf__timeline_summary
2451+
24422452
- name: Staging_build_linux analyze
24432453
presubmit: false
24442454
bringup: true
@@ -4049,6 +4059,16 @@ targets:
40494059
["devicelab", "ios", "mac"]
40504060
task_name: flutter_gallery__transition_perf_e2e_impeller_ios
40514061

4062+
- name: Mac_ios animated_blur_backdrop_filter_perf_ios__timeline_summary
4063+
recipe: devicelab/devicelab_drone
4064+
presubmit: false
4065+
timeout: 60
4066+
bringup: true
4067+
properties:
4068+
tags: >
4069+
["devicelab", "ios", "mac"]
4070+
task_name: animated_blur_backdrop_filter_perf_ios__timeline_summary
4071+
40524072
- name: Mac_ios spell_check_test
40534073
recipe: devicelab/devicelab_drone
40544074
presubmit: false

TESTOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
/dev/devicelab/bin/tasks/textfield_perf__e2e_summary.dart @zanderso @flutter/engine
9090
/dev/devicelab/bin/tasks/web_size__compile_test.dart @yjbanov @flutter/web
9191
/dev/devicelab/bin/tasks/wide_gamut_ios.dart @gaaclarke @flutter/engine
92+
/dev/devicelab/bin/tasks/animated_blur_backdrop_filter_perf__timeline_summary.dart @jonahwilliams @flutter/engine
9293

9394
## Windows Android DeviceLab tests
9495
/dev/devicelab/bin/tasks/basic_material_app_win__compile.dart @zanderso @flutter/tool
@@ -208,6 +209,7 @@
208209
/dev/devicelab/bin/tasks/simple_animation_perf_ios.dart @zanderso @flutter/engine
209210
/dev/devicelab/bin/tasks/tiles_scroll_perf_impeller_ios__timeline_summary.dart @zanderso @flutter/engine
210211
/dev/devicelab/bin/tasks/tiles_scroll_perf_ios__timeline_summary.dart @zanderso @flutter/engine
212+
/dev/devicelab/bin/tasks/animated_blur_backdrop_filter_perf_ios__timeline_summary.dart @jonahwilliams @flutter/engine
211213

212214
## Host only DeviceLab tests
213215
/dev/devicelab/bin/tasks/animated_complex_opacity_perf_macos__e2e_summary.dart @cbracken @flutter/desktop

dev/benchmarks/macrobenchmarks/lib/common.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const String kGradientPerfRouteName = '/gradient_perf';
3333
const String kAnimatedComplexOpacityPerfRouteName = '/animated_complex_opacity';
3434
const String kAnimatedComplexImageFilteredPerfRouteName = '/animated_complex_image_filtered';
3535
const String kListTextLayoutRouteName = '/list_text_layout';
36+
const String kAnimatedBlurBackdropFilter = '/animated_blur_backdrop_filter';
3637

3738
const String kOpacityPeepholeOneRectRouteName = '$kOpacityPeepholeRouteName/one_big_rect';
3839
const String kOpacityPeepholeColumnOfOpacityRouteName = '$kOpacityPeepholeRouteName/column_of_opacity';

dev/benchmarks/macrobenchmarks/lib/main.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import 'package:flutter/material.dart';
66

77
import 'common.dart';
8-
8+
import 'src/animated_blur_backdrop_filter.dart';
99
import 'src/animated_complex_image_filtered.dart';
1010
import 'src/animated_complex_opacity.dart';
1111
import 'src/animated_image.dart';
@@ -84,6 +84,7 @@ class MacrobenchmarksApp extends StatelessWidget {
8484
kAnimatedComplexOpacityPerfRouteName: (BuildContext context) => const AnimatedComplexOpacity(),
8585
kListTextLayoutRouteName: (BuildContext context) => const ColumnOfText(),
8686
kAnimatedComplexImageFilteredPerfRouteName: (BuildContext context) => const AnimatedComplexImageFiltered(),
87+
kAnimatedBlurBackdropFilter: (BuildContext context) => const AnimatedBlurBackdropFilter(),
8788
},
8889
);
8990
}
@@ -311,6 +312,13 @@ class HomePage extends StatelessWidget {
311312
Navigator.pushNamed(context, kListTextLayoutRouteName);
312313
},
313314
),
315+
ElevatedButton(
316+
key: const Key(kAnimatedBlurBackdropFilter),
317+
child: const Text('An animating backdrop filter'),
318+
onPressed: () {
319+
Navigator.pushNamed(context, kAnimatedBlurBackdropFilter);
320+
},
321+
),
314322
],
315323
),
316324
);
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'dart:ui' as ui;
6+
import 'package:flutter/material.dart';
7+
8+
// Various tests to verify that animated image filtered layers do not
9+
// dirty children even without explicit repaint boundaries. These intentionally use
10+
// text to ensure we don't measure the opacity peephole case.
11+
class AnimatedBlurBackdropFilter extends StatefulWidget {
12+
const AnimatedBlurBackdropFilter({ super.key });
13+
14+
@override
15+
State<AnimatedBlurBackdropFilter> createState() => _AnimatedBlurBackdropFilterState();
16+
}
17+
18+
class _AnimatedBlurBackdropFilterState extends State<AnimatedBlurBackdropFilter> with SingleTickerProviderStateMixin {
19+
late final AnimationController controller = AnimationController(vsync: this, duration: const Duration(milliseconds: 5000));
20+
late final Animation<double> animation = controller.drive(Tween<double>(begin: 0.0, end: 1.0));
21+
ui.ImageFilter imageFilter = ui.ImageFilter.blur();
22+
23+
@override
24+
void initState() {
25+
super.initState();
26+
controller.repeat();
27+
animation.addListener(() {
28+
setState(() {
29+
imageFilter = ui.ImageFilter.blur(
30+
sigmaX: animation.value * 16,
31+
sigmaY: animation.value * 16,
32+
tileMode: TileMode.decal,
33+
);
34+
});
35+
});
36+
}
37+
38+
@override
39+
void dispose() {
40+
controller.dispose();
41+
super.dispose();
42+
}
43+
44+
@override
45+
Widget build(BuildContext context) {
46+
return MaterialApp(
47+
home: Scaffold(
48+
body: Stack(
49+
children: <Widget>[
50+
ListView(
51+
children: <Widget>[
52+
for (int i = 0; i < 30; i++)
53+
Center(
54+
child: Transform.scale(scale: 1.01, child: const ModeratelyComplexWidget()),
55+
),
56+
],
57+
),
58+
BackdropFilter(
59+
filter: imageFilter,
60+
child: const SizedBox.expand(),
61+
),
62+
],
63+
),
64+
),
65+
);
66+
}
67+
}
68+
69+
class ModeratelyComplexWidget extends StatelessWidget {
70+
const ModeratelyComplexWidget({ super.key });
71+
72+
@override
73+
Widget build(BuildContext context) {
74+
return const Material(
75+
elevation: 10,
76+
clipBehavior: Clip.hardEdge,
77+
child: ListTile(
78+
leading: Icon(Icons.abc, size: 24),
79+
title: DecoratedBox(decoration: BoxDecoration(color: Colors.red), child: Text('Hello World')),
80+
trailing: FlutterLogo(),
81+
),
82+
);
83+
}
84+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'package:macrobenchmarks/common.dart';
6+
7+
import 'util.dart';
8+
9+
void main() {
10+
macroPerfTest(
11+
'animated_blur_backdrop_filter_perf',
12+
kAnimatedBlurBackdropFilter,
13+
pageDelay: const Duration(seconds: 1),
14+
duration: const Duration(seconds: 10),
15+
);
16+
}

dev/benchmarks/macrobenchmarks/test_driver/util.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Future<void> runDriverTestForRoute(String routeName, DriverTestCallBack body) as
2323
expect(scrollable, isNotNull);
2424
final SerializableFinder button = find.byValueKey(routeName);
2525
expect(button, isNotNull);
26-
await driver.scrollUntilVisible(scrollable, button, dyScroll: -50.0);
26+
await driver.scrollUntilVisible(scrollable, button, dyScroll: -100.0);
2727
await driver.tap(button);
2828

2929
await body(driver);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'dart:async';
6+
7+
import 'package:flutter_devicelab/framework/devices.dart';
8+
import 'package:flutter_devicelab/framework/framework.dart';
9+
import 'package:flutter_devicelab/tasks/perf_tests.dart';
10+
11+
Future<void> main() async {
12+
deviceOperatingSystem = DeviceOperatingSystem.android;
13+
await task(createAnimatedBlurBackropFilterPerfTest(enableImpeller: true));
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'dart:async';
6+
7+
import 'package:flutter_devicelab/framework/devices.dart';
8+
import 'package:flutter_devicelab/framework/framework.dart';
9+
import 'package:flutter_devicelab/tasks/perf_tests.dart';
10+
11+
Future<void> main() async {
12+
deviceOperatingSystem = DeviceOperatingSystem.ios;
13+
await task(createAnimatedBlurBackropFilterPerfTest());
14+
}

dev/devicelab/lib/tasks/perf_tests.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,19 @@ TaskFunction createGradientStaticPerfE2ETest() {
620620
).run;
621621
}
622622

623+
TaskFunction createAnimatedBlurBackropFilterPerfTest({
624+
bool enableImpeller = false,
625+
}) {
626+
return PerfTest(
627+
'${flutterDirectory.path}/dev/benchmarks/macrobenchmarks',
628+
'test_driver/run_app.dart',
629+
'animated_blur_backdrop_filter_perf',
630+
enableImpeller: enableImpeller,
631+
testDriver: 'test_driver/animated_blur_backdrop_filter_perf_test.dart',
632+
saveTraceFile: true,
633+
).run;
634+
}
635+
623636
TaskFunction createAnimatedComplexOpacityPerfE2ETest({
624637
bool enableImpeller = false,
625638
}) {

0 commit comments

Comments
 (0)