Skip to content

Using Scene.toGpuImage seems to aggressively trigger GC during frame workload #106698

@jonahwilliams

Description

@jonahwilliams

When running through some benchmarks with the timeline enabled, I've noticed that pretty much every call to Scene.toGpuImage results in a GC:

Flutter DevTools - Google Chrome 6_27_2022 1_25_58 PM

Flutter DevTools - Google Chrome 6_27_2022 1_34_24 PM

According to @dnfield this is expected, because Dart may need to reduce PSS size before allocating the large texture.

(The ui.Image created by Scene.toGpuImage and Picture.toImage reports an estimation of its external size as 4 * width * height to Dart: https://github.com/flutter/engine/pull/33736/files#diff-44a029b47e68b6b14a22356aef963e5f11bbd67e906c4d38fdef67153ba211a2R46-R52)

Generally triggering a GC during a frame workload is bad.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: performanceRelates to speed or footprint issues (see "perf:" labels)dependency: dartDart team may need to help usengineflutter/engine related. See also e: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions