Skip to content

Optimize Animation Resource, Library, Mixer, and Player#116394

Merged
akien-mga merged 1 commit into
godotengine:masterfrom
Ryan-000:ryan-opt-anim
Mar 9, 2026
Merged

Optimize Animation Resource, Library, Mixer, and Player#116394
akien-mga merged 1 commit into
godotengine:masterfrom
Ryan-000:ryan-opt-anim

Conversation

@Ryan-000
Copy link
Copy Markdown
Contributor

@Ryan-000 Ryan-000 commented Feb 17, 2026

Supersedes #113442

Related #112308 #110474

@TokageItLab I will rebase #113444 once this makes it in

Benchmark

Compiled with scons production=yes debug_symbols=yes target=editor
Ran with ./engine_binary --headless --print-fps --path /path/to/project res://path_to_world.tscn
Project: optimize.zip


Scene: res://World.tscn

Before: (220b0b2)

FPS: high 197, low 190, median 195
MSPF: high 5.26, low 5.07, median 5.12

After: (73d041d)

FPS: high 225, low 219, median 222.5
MSPF: high 4.56, low 4.44, median 4.49

median FPS change: +27.5 (+14.10%)
median MSPF change: -0.63 (-12.30%)


Scene: res://World_StressTest.tscn

Before (220b0b2)

FPS: high 99, low 93, median 97
MSPF: high 10.75, low 10.10, median 10.30

After: (73d041d)

FPS: high 104, low 101, median 103
MSPF: high 9.90, low 9.61, median 9.70

median FPS change: +6 (+6.19%)
median MSPF change: -0.60 (-5.83%)

@TokageItLab
Copy link
Copy Markdown
Member

TokageItLab commented Feb 17, 2026

@Ryan-000 Can you separate the commit which related with only AnimationTree as I did in #113444 ? Ah I see, this PR is based on #113442, so this is not including #113444. Alright, I will review.

@TokageItLab TokageItLab added this to the 4.x milestone Feb 17, 2026
@fire fire changed the title Optimization Animation Resource, Library, Mixer, Player Optimize Animation Resource, Library, Mixer, and Player Feb 17, 2026
Comment thread misc/extension_api_validation/4.6-stable/GH-113442.txt
Copy link
Copy Markdown
Member

@TokageItLab TokageItLab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR doesn't work correctly. This seems to break #110474 (review) AnimationTree example.

nested_tree.zip

Also, there is a potential conflict in EditorFolding::_fill_folds() by #113479, so please rebase to the latest master.

@Ryan-000 Ryan-000 force-pushed the ryan-opt-anim branch 2 times, most recently from b6efcab to d744748 Compare March 1, 2026 22:33
@Ryan-000 Ryan-000 requested a review from TokageItLab March 1, 2026 23:24
Copy link
Copy Markdown
Member

@TokageItLab TokageItLab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it works now. However, it seems to include implementations unrelated to optimization, so those should be removed from this PR.

Comment thread scene/animation/animation_tree.cpp
Comment thread scene/animation/animation_mixer.cpp Outdated
Comment thread scene/resources/animation.cpp Outdated
@Ryan-000 Ryan-000 force-pushed the ryan-opt-anim branch 3 times, most recently from e4f3e62 to 932c230 Compare March 3, 2026 05:35
@Ryan-000 Ryan-000 requested a review from TokageItLab March 3, 2026 06:25
Comment thread scene/animation/animation_mixer.cpp Outdated
Comment thread scene/animation/animation_mixer.cpp Outdated
@Ryan-000 Ryan-000 force-pushed the ryan-opt-anim branch 2 times, most recently from f07fcc0 to 2f5018c Compare March 3, 2026 19:07
Copy link
Copy Markdown
Member

@TokageItLab TokageItLab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is throwing a network error, but I believe the current code is fine (I'll re-run it later). I'll double-check it at the Animation Meeting this weekend just to be sure.

Co-Authored-By: Silc Lizard (Tokage) Renew <tokage.it.lab@gmail.com>
@lyuma
Copy link
Copy Markdown
Contributor

lyuma commented Mar 7, 2026

Referencing the performance numbers in the original PR:
#112308 (comment)

@Ryan-000 We would like to consider adding the benchmark from that comment to be added to the Godot benchmarks repository. Are the animations in this optimize project licensed such that they can be added to godot benchmarks?
(If not, would it be possible to submit the example project and swap out the animations with my own CC0 animation set?)

Compiled with scons compiledb=yes debug_symbols=yes linker=mold production=yes lto=none Ran with ./engine_binary --headless --print-fps --path /path/to/project res://path_to_world.tscn Project: optimize.zip

Scene: "res://World_StressTest.tscn"

Before this patch (0fdbf05)

FPS: high 89, low 86, median 88 MSPF: high 11.62, low 11.23, median 11.36

After:

FPS: high 122, low 119, median 121 MSPF: high 8.40, low 8.19, median 8.26

median FPS change: +33 (+37.50%) median MSPF change: -3.10 (-27.29%)

Scene: "res://World.tscn"

Before this patch (0fdbf05)

FPS: high 176, low 170, median 175 MSPF: high 5.88, low 5.68, median 5.71

After:

FPS: high 351, low 330, median 347 MSPF: high 3.03, low 2.84, median 2.88

median FPS change: +172 (+98.29%) median MSPF change: -2.83 (-49.56%)

Copy link
Copy Markdown
Contributor

@lyuma lyuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved in meeting.
We discussed that the track cache improvements in #117030 can be done after this is merged.

I'm happy with the benchmark. The benchmark is pretty comprehensive for the BlendTree, but we noticed there was no benchmark for the animation state machine. There may be more optimizations needed there, for example with state transitions.

I'm also wondering if there might be some advantage in caching the animation list. Even with the new get_animation_list function, it is making a copy of the list each time.

@Ryan-000
Copy link
Copy Markdown
Contributor Author

Ryan-000 commented Mar 7, 2026

Are the animations in this optimize project licensed such that they can be added to godot benchmarks?
(If not, would it be possible to submit the example project and swap out the animations with my own CC0 animation set?)

The character and animations are from Mixamo, so I am not sure whether they can be redistributed publicly. So you may need to replace them with your own.

One note: the animation tree is a stripped-down version from one of my projects (private animation references were replaced by a T-pose). Because of that, many of the nodes are effectively placeholders and do not currently contribute meaningful behaviour. I wanted to mention that in case it matters for benchmark use.

@akien-mga
Copy link
Copy Markdown
Member

@Ryan-000 Could you add benchmark numbers for this PR to the OP? Interested users will likely land here after it's merged from the next dev snapshot's release notes, and currently the description doesn't really tell them what to expect.

@akien-mga akien-mga merged commit f1f62d7 into godotengine:master Mar 9, 2026
20 checks passed
@akien-mga
Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants