GodotSharpStringCacher 1.0.0-alpha
See the version list below for details.
dotnet add package GodotSharpStringCacher --version 1.0.0-alpha
NuGet\Install-Package GodotSharpStringCacher -Version 1.0.0-alpha
<PackageReference Include="GodotSharpStringCacher" Version="1.0.0-alpha" />
<PackageVersion Include="GodotSharpStringCacher" Version="1.0.0-alpha" />
<PackageReference Include="GodotSharpStringCacher" />
paket add GodotSharpStringCacher --version 1.0.0-alpha
#r "nuget: GodotSharpStringCacher, 1.0.0-alpha"
#:package GodotSharpStringCacher@1.0.0-alpha
#addin nuget:?package=GodotSharpStringCacher&version=1.0.0-alpha&prerelease
#tool nuget:?package=GodotSharpStringCacher&version=1.0.0-alpha&prerelease
Automatically cache Godot Mono/C# StringName and NodePath without changing your code
What ?
Godot uses its own string types for a lot of features in the engine: StringName and NodePath. They each have their advantage which make a speed difference for the engine.
However in C# they are often implicited declared and can have performance impact.
For example, when writing something like Input.IsActionJustPressed("my_input"), the constructor to StringName is called on "my_input" without you noticing.
This results in the GC allocation of an object that will live for only one method.
Worse, the implementation of these constructors does potentially expensive calculations (for StringName, a hash is computed, which is then searched in a linked list. For NodePath, the string is deconstructed in its individual nodes, and a list is allocated to cache the results)
There are different proposals to circumvent this issue, here is mine.
Integrating
Include the package in your csproj file with
<PackageReference Include="GodotSharpStringCacher.MSBuild" Version="1.0.0-alpha" />
That's it ! The main assembly is now automatically patched.
If you want it to affect other packages, use
<ItemGroup>
<PackageReference Include="Foo.Bar" CacheStrings="true" />
<Reference Include=".../Foo.Bar.dll" CacheStrings="true" />
<ProjectReference Include=".../Foo.Bar.csproj" CacheStrings="true" />
<CacheStrings Include="Foo.Bar" />
</ItemGroup>
Quick Testing
If you want to test without integrating it, compile GodotSharpStringCacher.Console. The syntax is:
GodotSharpStringCacher.Console <in_file> <out_file> [--short-names]
You can browse the resulting assembly and see the results for yourself. (--short-names is explained below)
Short Names
By default, the variables created from your constant string in the assembly closely resemble the string. For example, "my_input" creates a variable called _my_input. This can help when statically reversing your own project.
If you don't want that in a specific assembly, you can add ShortNames=true. If you don't want that globally, add
<GDStringUseShortNames>true</GDStringUseShortNames>
How It Works
It executes after your project compiles and directly edits the resulting assembly. It uses AsmResolver, a library for assembly exploring and editing.
It looks for calls to these implicit conversion operators, then if the string is a constant, adds its value as a StringName/NodePath to a static class, then replaces the call with the load to this value.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- AsmResolver.DotNet (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.0 | 0 | 7/1/2026 |
| 1.0.8 | 51 | 6/29/2026 |
| 1.0.7 | 58 | 6/26/2026 |
| 1.0.7-alpha | 68 | 6/20/2026 |
| 1.0.6-alpha | 50 | 6/19/2026 |
| 1.0.5-alpha | 49 | 6/19/2026 |
| 1.0.4-alpha | 55 | 6/18/2026 |
| 1.0.3-alpha | 60 | 6/18/2026 |
| 1.0.2-alpha | 54 | 6/18/2026 |
| 1.0.1-alpha | 53 | 6/17/2026 |
| 1.0.0-alpha | 55 | 6/15/2026 |