Replies: 2 comments
-
See the pull request for this at godotengine/godot#100452. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi, I wrote my 2 cents in the PR. Hope this helps. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In C#, StringNames and NodePaths can be a footgun for garbage collection issues which cause performance spikes.
This can be a very insidious issue because of implicit casting:
To test the extent of the issue, I wrote the following code:
It creates, uses and discards 10,000 StringNames per physics frame, to be garbage collected. This uses FusionCache, but any capped-size dictionary could be used.
When

UseCache
is false, I get consistent 30ms spikes:When

UseCache
is true, I get a steady 17ms:Ideally, the C# API would exclusively use strings rather than StringNames. But until this is implemented, there should be a better StringName/NodePath API.
In my code, I've been doing this:
Then I can do:
However, I think this would be better implemented in the API itself, because of reduced footguns and simpler syntax.
Here's the StringName cast according to the reflector:
This could be changed to this:
Here's the project I used for profiling: stringnamestest.zip
Beta Was this translation helpful? Give feedback.
All reactions