Skip to content

Horrible Duplicate Performance #103357

Closed
Closed
@mrjustaguy

Description

@mrjustaguy

Tested versions

reproduced in 4.3 stable and 4.4 rc2

System information

Godot v4.3.stable - Windows 10.0.22631 - Vulkan (Forward+) - dedicated AMD Radeon RX 6600 (Advanced Micro Devices, Inc.; 32.0.12033.1030) - Intel(R) Core(TM) i3-10105F CPU @ 3.70GHz (8 Threads)

Issue description

Duplicate function is EXTREMELY expensive

in demo scene 100 duplicate calls take 30ms to execute, just to duplicate a simple standard material. having the material be local to scene and instancing the scene results in the same 30ms time to instantiate due to it calling duplicate for every one of the 100 scenes that each have a single local standard material

Steps to reproduce

open node3d scene

trigger ui left, ui up and ui right with a profiler
Observe massive spikes with the duplicate and local scene instancing not present with non local scene instancing

For me instancing and adding a child of the non local scene takes some 1.5ms for 100 instances, but some 30ms for instancing and adding a local scene, of which almost all the cost associated is due to the local scene internally calling duplicate for a single resource as can be demonstrated by just calling duplicate on the resource 100 times and getting the same performance cost.

Minimal reproduction project (MRP)

Duplicate.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions