Stop running shrinking gcs & simplify GC logic.

Shrinking GCs dump the JITted code, which leads to redundant recompilations, lowers performance, and makes profiling JS more difficult.
They may still happen if the runtime is at risk of OOM.
This commit is contained in:
Lancelot de Ferrière
2024-11-23 18:36:23 +01:00
committed by wraitii
parent d262eb8757
commit af32d386b9
8 changed files with 96 additions and 122 deletions
+6
View File
@@ -43,6 +43,7 @@
#include "renderer/TimeManager.h"
#include "renderer/WaterManager.h"
#include "scriptinterface/FunctionWrapper.h"
#include "scriptinterface/ScriptContext.h"
#include "scriptinterface/ScriptInterface.h"
#include "scriptinterface/JSON.h"
#include "simulation2/Simulation2.h"
@@ -331,6 +332,11 @@ PSRETURN CGame::ReallyStartGame()
// all be invisible)
Interpolate(0, 0);
// Run a shrinking GC to reset the memory before starting the game proper.
// This also clears JIT code, which seems like a good idea as the game init
// might have different patterns to the game itself.
m_Simulation2->GetScriptInterface().GetContext().ShrinkingGC();
m_GameStarted = true;
// Preload resources to avoid blinking on a first game frame.