Unverified Commit 63574cf7 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

add benchmark for animated complex opacity (#102532)

parent f15295cc
...@@ -1453,6 +1453,17 @@ targets: ...@@ -1453,6 +1453,17 @@ targets:
task_name: animated_image_gc_perf task_name: animated_image_gc_perf
scheduler: luci scheduler: luci
- name: Linux_android animated_complex_opacity_perf__e2e_summary
recipe: devicelab/devicelab_drone
presubmit: false
bringup: true
timeout: 60
properties:
tags: >
["devicelab","android","linux"]
task_name: animated_complex_opacity_perf__e2e_summary
scheduler: luci
- name: Linux_android animated_placeholder_perf__e2e_summary - name: Linux_android animated_placeholder_perf__e2e_summary
recipe: devicelab/devicelab_drone recipe: devicelab/devicelab_drone
presubmit: false presubmit: false
......
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
/dev/devicelab/bin/tasks/gradient_consistent_perf__e2e_summary.dart @flar @flutter/engine /dev/devicelab/bin/tasks/gradient_consistent_perf__e2e_summary.dart @flar @flutter/engine
/dev/devicelab/bin/tasks/gradient_dynamic_perf__e2e_summary.dart @flar @flutter/engine /dev/devicelab/bin/tasks/gradient_dynamic_perf__e2e_summary.dart @flar @flutter/engine
/dev/devicelab/bin/tasks/gradient_static_perf__e2e_summary.dart @flar @flutter/engine /dev/devicelab/bin/tasks/gradient_static_perf__e2e_summary.dart @flar @flutter/engine
/dev/devicelab/bin/tasks/animated_complex_opacity_perf__e2e_summary.dart @jonahwilliams @flutter/engine
## Windows Android DeviceLab tests ## Windows Android DeviceLab tests
/dev/devicelab/bin/tasks/basic_material_app_win__compile.dart @zanderso @flutter/tool /dev/devicelab/bin/tasks/basic_material_app_win__compile.dart @zanderso @flutter/tool
......
...@@ -21,6 +21,7 @@ found in the LICENSE file. --> ...@@ -21,6 +21,7 @@ found in the LICENSE file. -->
android:label="macrobenchmarks" android:label="macrobenchmarks"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher">
<activity <activity
android:exported="true"
android:name=".MainActivity" android:name=".MainActivity"
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@style/LaunchTheme" android:theme="@style/LaunchTheme"
......
...@@ -27,6 +27,7 @@ const String kAnimationWithMicrotasksRouteName = '/animation_with_microtasks'; ...@@ -27,6 +27,7 @@ const String kAnimationWithMicrotasksRouteName = '/animation_with_microtasks';
const String kAnimatedImageRouteName = '/animated_image'; const String kAnimatedImageRouteName = '/animated_image';
const String kOpacityPeepholeRouteName = '/opacity_peephole'; const String kOpacityPeepholeRouteName = '/opacity_peephole';
const String kGradientPerfRouteName = '/gradient_perf'; const String kGradientPerfRouteName = '/gradient_perf';
const String kAnimatedComplexOpacityPerfRouteName = '/animated_complex_opacity';
const String kOpacityPeepholeOneRectRouteName = '$kOpacityPeepholeRouteName/one_big_rect'; const String kOpacityPeepholeOneRectRouteName = '$kOpacityPeepholeRouteName/one_big_rect';
const String kOpacityPeepholeColumnOfOpacityRouteName = '$kOpacityPeepholeRouteName/column_of_opacity'; const String kOpacityPeepholeColumnOfOpacityRouteName = '$kOpacityPeepholeRouteName/column_of_opacity';
......
...@@ -6,6 +6,7 @@ import 'package:flutter/material.dart'; ...@@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
import 'common.dart'; import 'common.dart';
import 'src/animated_complex_opacity.dart';
import 'src/animated_image.dart'; import 'src/animated_image.dart';
import 'src/animated_placeholder.dart'; import 'src/animated_placeholder.dart';
import 'src/animation_with_microtasks.dart'; import 'src/animation_with_microtasks.dart';
...@@ -72,6 +73,7 @@ class MacrobenchmarksApp extends StatelessWidget { ...@@ -72,6 +73,7 @@ class MacrobenchmarksApp extends StatelessWidget {
...opacityPeepholeRoutes, ...opacityPeepholeRoutes,
kGradientPerfRouteName: (BuildContext context) => const GradientPerfHomePage(), kGradientPerfRouteName: (BuildContext context) => const GradientPerfHomePage(),
...gradientPerfRoutes, ...gradientPerfRoutes,
kAnimatedComplexOpacityPerfRouteName: (BuildContext context) => const AnimatedComplexOpacity(),
}, },
); );
} }
...@@ -257,6 +259,13 @@ class HomePage extends StatelessWidget { ...@@ -257,6 +259,13 @@ class HomePage extends StatelessWidget {
Navigator.pushNamed(context, kGradientPerfRouteName); Navigator.pushNamed(context, kGradientPerfRouteName);
}, },
), ),
ElevatedButton(
key: const Key(kAnimatedComplexOpacityPerfRouteName),
child: const Text('Animated complex opacity perf'),
onPressed: () {
Navigator.pushNamed(context, kAnimatedComplexOpacityPerfRouteName);
},
),
], ],
), ),
); );
......
// 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';
// Various tests to verify that Aniamted opacity layers (i.e. FadeTransition) do not
// dirty children even without explicit repaint boundaries. These intentionally use
// text to ensure we don't measure the opacity peephole case.
class AnimatedComplexOpacity extends StatefulWidget {
const AnimatedComplexOpacity({ super.key });
@override
State<AnimatedComplexOpacity> createState() => _AnimatedComplexOpacityState();
}
class _AnimatedComplexOpacityState extends State<AnimatedComplexOpacity> with SingleTickerProviderStateMixin {
late final AnimationController controller = AnimationController(vsync: this, duration: const Duration(milliseconds: 5000));
late final Animation<double> animation = controller.drive(Tween<double>(begin: 0.0, end: 1.0));
@override
void initState() {
super.initState();
controller.forward(from: 0.0);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: ListView(
children: <Widget>[
for (int i = 0; i < 20; i++)
FadeTransition(opacity: animation, child: Center(
child: Transform.scale(scale: 1.01, child: const ModeratelyComplexWidget()),
))
],
),
),
);
}
}
class ModeratelyComplexWidget extends StatelessWidget {
const ModeratelyComplexWidget({ super.key });
@override
Widget build(BuildContext context) {
return const Material(
elevation: 10,
clipBehavior: Clip.hardEdge,
child: ListTile(
leading: Icon(Icons.abc, size: 24),
title: DecoratedBox(decoration: BoxDecoration(color: Colors.red), child: Text('Hello World')),
trailing: FlutterLogo(),
),
);
}
}
// 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 'dart:async';
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(createAnimatedComplexOpacityPerfE2ETest());
}
...@@ -577,6 +577,13 @@ TaskFunction createGradientStaticPerfE2ETest() { ...@@ -577,6 +577,13 @@ TaskFunction createGradientStaticPerfE2ETest() {
).run; ).run;
} }
TaskFunction createAnimatedComplexOpacityPerfE2ETest() {
return PerfTest.e2e(
'${flutterDirectory.path}/dev/benchmarks/macrobenchmarks',
'test/animated_complex_opacity_perf_e2e.dart',
).run;
}
Map<String, dynamic> _average(List<Map<String, dynamic>> results, int iterations) { Map<String, dynamic> _average(List<Map<String, dynamic>> results, int iterations) {
final Map<String, dynamic> tally = <String, dynamic>{}; final Map<String, dynamic> tally = <String, dynamic>{};
for (final Map<String, dynamic> item in results) { for (final Map<String, dynamic> item in results) {
......
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