Optimize VariantType to use static type name in game or from non-reloadable assemblies

This avoids many dynamic memory allocations in Visual Scripts and Anim Graph.

#
This commit is contained in:
Wojtek Figat
2026-02-09 18:01:47 +01:00
parent bd300651ec
commit 7b7a92758f
10 changed files with 170 additions and 53 deletions

View File

@@ -34,6 +34,7 @@ private:
int32 _isLoaded : 1;
int32 _isLoading : 1;
int32 _canReload : 1;
mutable int32 _hasCachedClasses : 1;
mutable ClassesDictionary _classes;
@@ -125,6 +126,14 @@ public:
return _isLoaded != 0;
}
/// <summary>
/// Returns true if assembly can be hot-reloaded at runtime. For example, in Editor after scripts recompilation. Some assemblies such as engine and class library modules are static.
/// </summary>
FORCE_INLINE bool CanReload() const
{
return USE_EDITOR && _canReload;
}
/// <summary>
/// Gets the assembly name.
/// </summary>

View File

@@ -45,6 +45,7 @@ MAssembly::MAssembly(MDomain* domain, const StringAnsiView& name)
: _domain(domain)
, _isLoaded(false)
, _isLoading(false)
, _canReload(true)
, _hasCachedClasses(false)
, _reloadCount(0)
, _name(name)
@@ -59,6 +60,7 @@ MAssembly::MAssembly(MDomain* domain, const StringAnsiView& name, const StringAn
, _domain(domain)
, _isLoaded(false)
, _isLoading(false)
, _canReload(true)
, _hasCachedClasses(false)
, _reloadCount(0)
, _name(name)