Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add benchmark case for RasterCache #103338

Merged

Conversation

JsouLiang
Copy link
Contributor

@JsouLiang JsouLiang commented May 9, 2022

Add a scenario for test raster cache memory use and render time
flutter/engine#31892

In this benchmark test scenario, I build a ListView that will have 3 Children, the first LayerTree is an ImageFilterLayer and a DisplayListLayer, the second LayerTree is a ShaderMaskLayer subtree, and the third is a DisplayListLayer.

According to the existing RasterCache logic, the ImageFilterLayer will be cached many times because it is a bottom-up cache process.

However, this PR differentiates the RasterCache process and changes it to a top-down logic, so that once the parent ImageFilterLayer is cached, the child node will not have any extra cache.

The Layer tree is shown in the following figure
image

cc @flar

@JsouLiang JsouLiang requested a review from keyonghan as a code owner May 9, 2022 11:34
@flutter-dashboard flutter-dashboard bot added the team Infra upgrades, team productivity, code health, technical debt. See also team: labels. label May 9, 2022
@JsouLiang
Copy link
Contributor Author

JsouLiang commented May 9, 2022

═════════════════════════╡ ••• Final A/B results ••• ╞══════════════════════════

Score Average A (noise) Average B (noise) Speed-up
average_frame_build_time_millis 0.60 (0.58%) 0.68 (0.66%) 0.89x
worst_frame_build_time_millis 0.86 (1.92%) 1.44 (27.44%) 0.60x
90th_percentile_frame_build_time_millis 0.69 (0.87%) 0.77 (1.49%) 0.89x
99th_percentile_frame_build_time_millis 0.80 (0.38%) 0.89 (0.22%) 0.89x
average_frame_rasterizer_time_millis 2.36 (14.99%) 2.04 (2.06%) 1.16x
worst_frame_rasterizer_time_millis 4.08 (5.18%) 4.22 (10.98%) 0.97x
90th_percentile_frame_rasterizer_time_millis 2.78 (14.25%) 2.40 (3.33%) 1.16x
99th_percentile_frame_rasterizer_time_millis 3.60 (2.83%) 3.29 (0.30%) 1.09x
average_layer_cache_count 4.00 (0.00%) 2.00 (0.00%) 2.00x
90th_percentile_layer_cache_count 4.00 (0.00%) 2.00 (0.00%) 2.00x
99th_percentile_layer_cache_count 4.00 (0.00%) 2.00 (0.00%) 2.00x
worst_layer_cache_count 4.00 (0.00%) 2.00 (0.00%) 2.00x
average_layer_cache_memory 11.79 (0.00%) 5.03 (0.00%) 2.34x
90th_percentile_layer_cache_memory 11.79 (0.00%) 5.03 (0.00%) 2.34x
99th_percentile_layer_cache_memory 11.79 (0.00%) 5.03 (0.00%) 2.34x
worst_layer_cache_memory 11.79 (0.00%) 5.03 (0.00%) 2.34x
average_picture_cache_count 1.00 (0.00%) 1.00 (0.00%) 1.00x
90th_percentile_picture_cache_count 1.00 (0.00%) 1.00 (0.00%) 1.00x
99th_percentile_picture_cache_count 1.00 (0.00%) 1.00 (0.00%) 1.00x
worst_picture_cache_count 1.00 (0.00%) 1.00 (0.00%) 1.00x
average_picture_cache_memory 2.90 (0.00%) 2.90 (0.00%) 1.00x
90th_percentile_picture_cache_memory 2.90 (0.00%) 2.90 (0.00%) 1.00x
99th_percentile_picture_cache_memory 2.90 (0.00%) 2.90 (0.00%) 1.00x
worst_picture_cache_memory 2.90 (0.00%) 2.90 (0.00%) 1.00x
new_gen_gc_count 1.00 (100.00%) 2.00 (0.00%) 0.50x
old_gen_gc_count 0.00 (0.00%) 0.00 (0.00%) NaNx

cc @flar

@JsouLiang JsouLiang force-pushed the raster-cache-use-memory-benchmark branch 2 times, most recently from f018e83 to 7d7fb04 Compare May 9, 2022 13:26
.ci.yaml Show resolved Hide resolved
@JsouLiang JsouLiang force-pushed the raster-cache-use-memory-benchmark branch from 7d7fb04 to a2e1967 Compare May 10, 2022 03:10
@JsouLiang JsouLiang requested a review from keyonghan May 10, 2022 04:02
Copy link
Contributor

@keyonghan keyonghan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with config changes. /cc @flar may need to review the test codes.

@eggfly eggfly requested a review from flar May 11, 2022 02:55
@flar
Copy link
Contributor

flar commented May 12, 2022

Can you describe what this benchmark is aiming to test? Are there specific cases of double-caching in here that we should find eliminated with the upcoming raster pass fix? Is it more of a general "how fast is caching" benchmark?

Also, the sizes are pretty big, I don't think I'm seeing all of the content here. We run these benchmarks in labs that mostly consist of Moto G4 phones and I can barely see the top of the first logo briefly. Much of the content is probably never rendered due to bounds testing. Even running on my Mac screen the content is too big for the screen.

@JsouLiang
Copy link
Contributor Author

Score Average A (noise) Average B (noise) Speed-up
average_frame_build_time_millis 1.46 (0.00%) 1.02 (0.00%) 1.43x
worst_frame_build_time_millis 4.12 (0.00%) 1.89 (0.00%) 2.18x
90th_percentile_frame_build_time_millis 1.77 (0.00%) 1.17 (0.00%) 1.51x
99th_percentile_frame_build_time_millis 2.56 (0.00%) 1.42 (0.00%) 1.81x
average_frame_rasterizer_time_millis 3.80 (0.00%) 3.47 (0.00%) 1.10x
worst_frame_rasterizer_time_millis 8.45 (0.00%) 9.84 (0.00%) 0.86x
90th_percentile_frame_rasterizer_time_millis 5.10 (0.00%) 4.43 (0.00%) 1.15x
99th_percentile_frame_rasterizer_time_millis 6.92 (0.00%) 6.89 (0.00%) 1.01x
average_layer_cache_count 3.56 (0.00%) 1.54 (0.00%) 2.31x
90th_percentile_layer_cache_count 4.00 (0.00%) 2.00 (0.00%) 2.00x
99th_percentile_layer_cache_count 4.00 (0.00%) 2.00 (0.00%) 2.00x
worst_layer_cache_count 4.00 (0.00%) 2.00 (0.00%) 2.00x
average_layer_cache_memory 0.82 (0.00%) 0.46 (0.00%) 1.81x
90th_percentile_layer_cache_memory 1.02 (0.00%) 0.66 (0.00%) 1.55x
99th_percentile_layer_cache_memory 1.02 (0.00%) 0.66 (0.00%) 1.55x
worst_layer_cache_memory 1.02 (0.00%) 0.66 (0.00%) 1.55x
average_picture_cache_count 1.00 (0.00%) 1.00 (0.00%) 1.00x
90th_percentile_picture_cache_count 1.00 (0.00%) 1.00 (0.00%) 1.00x
99th_percentile_picture_cache_count 1.00 (0.00%) 1.00 (0.00%) 1.00x
worst_picture_cache_count 1.00 (0.00%) 1.00 (0.00%) 1.00x
average_picture_cache_memory 0.03 (0.00%) 0.03 (0.00%) 1.00x
90th_percentile_picture_cache_memory 0.03 (0.00%) 0.03 (0.00%) 1.00x
99th_percentile_picture_cache_memory 0.03 (0.00%) 0.03 (0.00%) 1.00x
worst_picture_cache_memory 0.03 (0.00%) 0.03 (0.00%) 1.00x
new_gen_gc_count 4.00 (0.00%) 4.00 (0.00%) 1.00x
old_gen_gc_count 0.00 (0.00%) 0.00 (0.00%) NaNx

And by this change, the display is normal on my device(HUAWEI device, the screen size is 5.5 inches, screen resolution is 720*1280), and above is the benchmark data
cc @flar

@JsouLiang
Copy link
Contributor Author

@flar Friendly ping.

@JsouLiang JsouLiang force-pushed the raster-cache-use-memory-benchmark branch from 91c838e to 8b267cb Compare May 20, 2022 12:23
Copy link
Contributor

@flar flar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@flar flar added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 29, 2022
@auto-submit auto-submit bot merged commit f0200f0 into flutter:master Jun 29, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 30, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 30, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 30, 2022
camsim99 pushed a commit to camsim99/flutter that referenced this pull request Aug 10, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 30, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App team Infra upgrades, team productivity, code health, technical debt. See also team: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants