diff --git a/.ci.yaml b/.ci.yaml index 737c2055858..0a5791cec7c 100755 --- a/.ci.yaml +++ b/.ci.yaml @@ -1522,7 +1522,18 @@ targets: tags: > ["devicelab","android","linux"] task_name: color_filter_cache_perf__e2e_summary - benchmark: "true" + scheduler: luci + + - name: Linux_android shader_mask_cache_perf__e2e_summary + bringup: true + recipe: devicelab/devicelab_drone + presubmit: false + timeout: 60 + properties: + tags: > + ["devicelab","android","linux"] + task_name: shader_mask_cache_perf__e2e_summary + scheduler: luci - name: Linux_android complex_layout_android__compile recipe: devicelab/devicelab_drone diff --git a/TESTOWNERS b/TESTOWNERS index ff2085fe445..dd4cd101f0d 100644 --- a/TESTOWNERS +++ b/TESTOWNERS @@ -23,6 +23,7 @@ /dev/devicelab/bin/tasks/basic_material_app_android__compile.dart @zanderso @flutter/tool /dev/devicelab/bin/tasks/codegen_integration.dart @zanderso @flutter/tool /dev/devicelab/bin/tasks/color_filter_and_fade_perf__e2e_summary.dart @zanderso @flutter/engine +/dev/devicelab/bin/tasks/shader_mask_cache_perf__e2e_summary.dart @flar @flutter/engine /dev/devicelab/bin/tasks/color_filter_cache_perf__e2e_summary.dart @flar @flutter/engine /dev/devicelab/bin/tasks/complex_layout_android__compile.dart @zanderso @flutter/tool /dev/devicelab/bin/tasks/complex_layout_android__scroll_smoothness.dart @zanderso @flutter/engine diff --git a/dev/benchmarks/macrobenchmarks/lib/common.dart b/dev/benchmarks/macrobenchmarks/lib/common.dart index 566b5260193..582a5d12f98 100644 --- a/dev/benchmarks/macrobenchmarks/lib/common.dart +++ b/dev/benchmarks/macrobenchmarks/lib/common.dart @@ -20,6 +20,7 @@ const String kFadingChildAnimationRouteName = '/fading_child_animation'; const String kImageFilteredTransformAnimationRouteName = '/imagefiltered_transform_animation'; const String kMultiWidgetConstructionRouteName = '/multi_widget_construction'; const String kHeavyGridViewRouteName = '/heavy_gridview'; +const String kShaderMaskCacheRouteName = '/shader_mask_cache'; const String kSimpleScrollRouteName = '/simple_scroll'; const String kStackSizeRouteName = '/stack_size'; const String kAnimationWithMicrotasksRouteName = '/animation_with_microtasks'; diff --git a/dev/benchmarks/macrobenchmarks/lib/main.dart b/dev/benchmarks/macrobenchmarks/lib/main.dart index b3545b226a4..9670bc093d5 100644 --- a/dev/benchmarks/macrobenchmarks/lib/main.dart +++ b/dev/benchmarks/macrobenchmarks/lib/main.dart @@ -24,6 +24,7 @@ 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/shader_mask_cache.dart'; import 'src/simple_animation.dart'; import 'src/simple_scroll.dart'; import 'src/stack_size.dart'; @@ -61,6 +62,7 @@ class MacrobenchmarksApp extends StatelessWidget { kImageFilteredTransformAnimationRouteName: (BuildContext context) => const FilteredChildAnimationPage(FilterType.rotateFilter), kMultiWidgetConstructionRouteName: (BuildContext context) => const MultiWidgetConstructTable(10, 20), kHeavyGridViewRouteName: (BuildContext context) => const HeavyGridViewPage(), + kShaderMaskCacheRouteName: (BuildContext context) => const ShaderMaskCachePage(), kSimpleScrollRouteName: (BuildContext context) => const SimpleScroll(), kStackSizeRouteName: (BuildContext context) => const StackSizePage(), kAnimationWithMicrotasksRouteName: (BuildContext context) => const AnimationWithMicrotasks(), @@ -175,6 +177,13 @@ class HomePage extends StatelessWidget { Navigator.pushNamed(context, kColorFilterCacheRouteName); }, ), + ElevatedButton( + key: const Key(kShaderMaskCacheRouteName), + child: const Text('Shader Mask Cache'), + onPressed: () { + Navigator.pushNamed(context, kShaderMaskCacheRouteName); + }, + ), ElevatedButton( key: const Key(kFadingChildAnimationRouteName), child: const Text('Fading Child Animation'), diff --git a/dev/benchmarks/macrobenchmarks/lib/src/shader_mask_cache.dart b/dev/benchmarks/macrobenchmarks/lib/src/shader_mask_cache.dart new file mode 100644 index 00000000000..79c8a0f5179 --- /dev/null +++ b/dev/benchmarks/macrobenchmarks/lib/src/shader_mask_cache.dart @@ -0,0 +1,80 @@ +// 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 'dart:ui'; +import 'package:flutter/material.dart'; +import 'picture_cache.dart'; + +class ShaderMaskCachePage extends StatefulWidget { + const ShaderMaskCachePage({Key? key}) : super(key: key); + @override + State createState() => _ShaderMaskCachePageState(); +} + +class _ShaderMaskCachePageState extends State + with TickerProviderStateMixin { + final ScrollController _controller = ScrollController(); + + @override + void initState() { + super.initState(); + _controller.addListener(() { + if (_controller.offset < 10) { + _controller.animateTo(100, duration: const Duration(milliseconds: 1000), curve: Curves.ease); + } else if (_controller.offset > 90) { + _controller.animateTo(0, duration: const Duration(milliseconds: 1000), curve: Curves.ease); + } + }); + Timer(const Duration(milliseconds: 500), () { + _controller.animateTo(100, duration: const Duration(milliseconds: 1000), curve: Curves.ease); + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.lightBlue, + body: ListView( + controller: _controller, + children: [ + const SizedBox(height: 100), + buildShaderMask(0), + const SizedBox(height: 10), + buildShaderMask(1), + const SizedBox(height: 1000), + ], + ), + ); + } + + Widget buildShaderMask(int index) { + return ShaderMask( + shaderCallback: (Rect bounds) { + return const RadialGradient( + center: Alignment.topLeft, + radius: 1.0, + colors: [Colors.yellow, Colors.red], + tileMode: TileMode.mirror, + ).createShader(bounds); + }, + child: Container( + clipBehavior: Clip.antiAlias, + decoration: const BoxDecoration(boxShadow: [ + BoxShadow( + color: Colors.white, + blurRadius: 5.0, + ), + ]), + child: ListItem(index: index), + ), + ); + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } +} diff --git a/dev/benchmarks/macrobenchmarks/test/shader_mask_cache_perf_e2e.dart b/dev/benchmarks/macrobenchmarks/test/shader_mask_cache_perf_e2e.dart new file mode 100644 index 00000000000..3f2ca4fce3b --- /dev/null +++ b/dev/benchmarks/macrobenchmarks/test/shader_mask_cache_perf_e2e.dart @@ -0,0 +1,16 @@ +// 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:macrobenchmarks/common.dart'; + +import 'util.dart'; + +void main() { + macroPerfTestE2E( + 'shader_mask_cache_perf', + kShaderMaskCacheRouteName, + pageDelay: const Duration(seconds: 1), + duration: const Duration(seconds: 10), + ); +} diff --git a/dev/devicelab/bin/tasks/shader_mask_cache_perf__e2e_summary.dart b/dev/devicelab/bin/tasks/shader_mask_cache_perf__e2e_summary.dart new file mode 100644 index 00000000000..70b13cb0539 --- /dev/null +++ b/dev/devicelab/bin/tasks/shader_mask_cache_perf__e2e_summary.dart @@ -0,0 +1,14 @@ +// 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 main() async { + deviceOperatingSystem = DeviceOperatingSystem.android; + await task(createShaderMaskCachePerfE2ETest()); +} diff --git a/dev/devicelab/lib/tasks/perf_tests.dart b/dev/devicelab/lib/tasks/perf_tests.dart index 9d60fdcfeb9..90d3abc906e 100644 --- a/dev/devicelab/lib/tasks/perf_tests.dart +++ b/dev/devicelab/lib/tasks/perf_tests.dart @@ -378,6 +378,13 @@ TaskFunction createColorFilterCachePerfE2ETest() { ).run; } +TaskFunction createShaderMaskCachePerfE2ETest() { + return PerfTest.e2e( + '${flutterDirectory.path}/dev/benchmarks/macrobenchmarks', + 'test/shader_mask_cache_perf_e2e.dart', + ).run; +} + TaskFunction createFadingChildAnimationPerfTest() { return PerfTest( '${flutterDirectory.path}/dev/benchmarks/macrobenchmarks',