Skip to content

Severe performance degradation of drawImageRect #165959

@spydon

Description

@spydon

Steps to reproduce

Clone https://github.com/jag2011/flutter_impeller_bunnies or run any app doing a lot of drawImageRect calls for Flutter v3.29.2 and compare to Flutter v3.27.4, and compare Skia to Impeller.

Expected results

We expect similar performance for Impeller and Skia, and no degradation in Impeller compared to v3.27.4.

This issue has been reported by many game creators and Flame users, which is to be expected since it's much more common to do many drawImageRect calls in the gamedev domain compared to normal apps.

Actual results

These results are from runs on a Nothing phone 1 (A063) in profile mode.

Entity count Flutter version Impeller Result
300 v3.29.2 yes
300 v3.29.2 no
300 v3.27.4 yes
300 v3.27.4 no
2000 v3.29.2 yes
2000 v3.29.2 no
2000 v3.27.4 yes Crash (sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory)
2000 v3.27.4 no

These results are for Android, but you'll see similar a degradation on iOS too if the MRE is run there.

Many thanks to @jag2011 for the MRE and @gnarhard for detailed report of the degradation.

Code sample

Reproduction code can be found here: https://github.com/jag2011/flutter_impeller_bunnies

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.2, on Ubuntu 24.04.2 LTS 6.8.0-55-generic,
    locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2023.1)
[✓] IntelliJ IDEA Community Edition (version 2024.3)
[✓] VS Code (version 1.98.2)
[✓] VS Code (version 1.99.0-insider)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: gamedevIssues related to game development with Flutterc: performanceRelates to speed or footprint issues (see "perf:" labels)customer: crowdAffects or could affect many people, though not necessarily a specific customer.e: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.r: fixedIssue is closed as already fixed in a newer versionteam-engineOwned by Engine team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions