godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.57k stars 20.73k forks source link

Skeleton Heavy CPU Bottleneck #93568

Open mrjustaguy opened 3 months ago

mrjustaguy commented 3 months ago

Tested versions

Tested 4.3 beta 1

System information

Windows 11, i3-10105f, RX6600 24.5.1, Forward+

Issue description

Skeletons seem to absolutely trash CPU performance. Editor reports over 30ms cpu frame time with skeletons vs 3ms for non skeletal copy of the scene

Only one thread is above 5% utilization, and the one that is being utilized keeps switching between 60% and 100% utilization despite locked frequency (so the utilization percentages aren't falsely being reported as 100% when the frequency drops)

This has been reported on before (https://github.com/godotengine/godot/issues/90943), but Hasn't provided samples for testing, so that's what I'm doing here.

do note, I've observed Shadows to be especially hard on the CPU, which is how I've first encountered this issue in my Project with only about a 100 skeletons and half a dozen omni lights and a sunlight casting shadows, while in the MRP to keep it simple I just threw 2 thousand skeletons to make the bottleneck more apparent and easier to diagnose.

Steps to reproduce

Open MRP

Compare Non Skeleton vs Skeleton Scene CPU Performance Metrics

Minimal reproduction project (MRP)

Perf test.zip

JekSun97 commented 3 months ago

On Godot 4.3 beta2 shows 20 frames per second, with skeletons, without skeletons everything is stable.

Godot v4.3.beta2 - Windows 10.0.19045 - Vulkan (Forward+) - dedicated Radeon RX 560 Series (Advanced Micro Devices, Inc.; 31.0.14001.45012) - Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz (4 Threads)

nicoszpako commented 2 months ago

Same here, I noticed this huge drop in performance when I have a lot of Skeleton3D (around ~100) loaded in a scene. What is weird is that it runs pretty well in the editor, as it is mentioned here (the problem may be linked).

Disabling the process of the Skeleton3D while the game is running brings back the FPS.

Godot v4.3.beta2 - AMD Ryzen 7 3800X - RTX 2070 - Windows 10