Skip to content

Commit 1c7e2af

Browse files
authored
Add static_path_tessellation macrobenchmark (#131837)
This adds a macrobenchmark representative of a real world application that uses SVG icons. The scenario of rasterizing complex paths that don't change over time does not seem to be covered by any other macrobenchmark and shows a significantly slower impeller performance compared to skia. It's actually bit problematic to measure this because on A15 the CPU load with impeller is high enough to trigger CPU frequency change. So in order to get consistent reading I had to add a spinning background thread that would keep the CPU at highest frequency. ```objc [NSThread detachNewThreadWithBlock:^{ while (true) { pthread_yield_np(); } }]; ``` ```bash flutter drive --profile --local-engine=ios_profile -t test_driver/run_app.dart --driver test_driver/path_tessellation_static_perf_test.dart ``` | average_frame_build_time_millis |Time| |--|--| | Impeller | 0.46686524822695047 | | Skia | 0.4625749999999999 | | Skia - No RasterCache | 0.47173750000000086| | average_frame_rasterizer_time_millis | Time | |--|--| | Impeller | 6.654328519855595 | | Skia - Raster Cache | 0.2534123711340209 * | | Skia - No RasterCache | 0.53424375 | * Adding the `GeometryPainter` seems to have triggered the complexity threshold for raster cache. <img alt="screenshot" width="320" src="https://github.com/flutter/flutter/assets/96958/7a2f9384-b512-477b-bffa-058d4d284a41"/>
1 parent ad0dbc8 commit 1c7e2af

6 files changed

Lines changed: 405 additions & 18 deletions

File tree

dev/benchmarks/macrobenchmarks/lib/common.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const String kPictureCacheRouteName = '/picture_cache';
1111
const String kPictureCacheComplexityScoringRouteName = '/picture_cache_complexity_scoring';
1212
const String kLargeImageChangerRouteName = '/large_image_changer';
1313
const String kLargeImagesRouteName = '/large_images';
14+
const String kPathTessellationRouteName = '/path_tessellation';
1415
const String kTextRouteName = '/text';
1516
const String kFullscreenTextRouteName = '/fullscreen_text';
1617
const String kAnimatedPlaceholderRouteName = '/animated_placeholder';

dev/benchmarks/macrobenchmarks/lib/main.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import 'src/large_images.dart';
2828
import 'src/list_text_layout.dart';
2929
import 'src/multi_widget_construction.dart';
3030
import 'src/opacity_peephole.dart';
31+
import 'src/path_tessellation.dart';
3132
import 'src/picture_cache.dart';
3233
import 'src/picture_cache_complexity_scoring.dart';
3334
import 'src/post_backdrop_filter.dart';
@@ -63,6 +64,7 @@ class MacrobenchmarksApp extends StatelessWidget {
6364
kLargeImageChangerRouteName: (BuildContext context) => const LargeImageChangerPage(),
6465
kLargeImagesRouteName: (BuildContext context) => const LargeImagesPage(),
6566
kTextRouteName: (BuildContext context) => const TextPage(),
67+
kPathTessellationRouteName: (BuildContext context) => const PathTessellationPage(),
6668
kFullscreenTextRouteName: (BuildContext context) => const TextFieldPage(),
6769
kAnimatedPlaceholderRouteName: (BuildContext context) => const AnimatedPlaceholderPage(),
6870
kClipperCacheRouteName: (BuildContext context) => const ClipperCachePage(),
@@ -162,6 +164,13 @@ class HomePage extends StatelessWidget {
162164
Navigator.pushNamed(context, kLargeImagesRouteName);
163165
},
164166
),
167+
ElevatedButton(
168+
key: const Key(kPathTessellationRouteName),
169+
child: const Text('Path Tessellation'),
170+
onPressed: () {
171+
Navigator.pushNamed(context, kPathTessellationRouteName);
172+
},
173+
),
165174
ElevatedButton(
166175
key: const Key(kTextRouteName),
167176
child: const Text('Text'),

0 commit comments

Comments
 (0)