Optimize various initial pre-allocs to happen within memory tracing

This commit is contained in:
Wojtek Figat
2026-03-23 18:25:05 +01:00
parent 90a0cc0e03
commit 3baec506e2
7 changed files with 71 additions and 13 deletions

View File

@@ -96,9 +96,9 @@ namespace
}
};
Dictionary<Guid, ScriptingObjectData> _objectsDictionary(1024 * 16);
Dictionary<Guid, ScriptingObjectData> _objectsDictionary;
#else
Dictionary<Guid, ScriptingObject*> _objectsDictionary(1024 * 16);
Dictionary<Guid, ScriptingObject*> _objectsDictionary;
#endif
bool _isEngineAssemblyLoaded = false;
bool _hasGameModulesLoaded = false;
@@ -179,6 +179,8 @@ bool ScriptingService::Init()
PROFILE_MEM(Scripting);
Stopwatch stopwatch;
_objectsDictionary.EnsureCapacity(16 * 1024);
// Initialize managed runtime
if (MCore::LoadEngine())
{