Skip to content

CanvasItem clip children is extremely slow #79439

@djrain

Description

@djrain

Godot version

4.1 stable

System information

macOS, Android, iOS - all renderers

Issue description

We're making a mobile game, and we were getting poor performance on Android. After some testing we found that having even a small number of nodes with clipping enabled was the culprit, making this feature borderline unusable. Turning clipping off brought the game back up to acceptable FPS.

The slowness happens in all renderers and not just on mobile. Having more children being clipped does not seem to matter much - only the total number of nodes with clipping enabled.

I would normally assume that clipping might have a significant performance impact, but this blog post stated that clipping happens "at literally no cost", which sounded too good to be true, but based on that this result is very unexpected.

If a notable performance hit is indeed expected when using this, it would be nice to have documented.

Steps to reproduce

Run MRP main scene. Press enter to toggle clipping on and off, and observe huge FPS change. (note vsync is off)
On my M1 Mac it drops from around 1300 fps to about 75.

Minimal reproduction project

ClipChildrenSlow.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    For team assessment

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions