From e2ff38453fdc1f32a2d88ea532a2ec9bf530d3b1 Mon Sep 17 00:00:00 2001 From: wraitii Date: Sat, 16 Jan 2021 10:33:00 +0000 Subject: [PATCH] Fix lag on OOS with AIs Following 9fc6c3c897, the OOS debugSerializer would try to serialize AI objects entirely. This is extremely slow (might be an infinite loop in some cases). Instead, it should print the result of Serialize() in those cases. (The original idea was that it would print more debugging information, but in practice it seems to mostly print things that show up when diffing but aren't actually sources of OOS, so essentially garbage). Fixes #5917 Differential Revision: https://code.wildfiregames.com/D3361 This was SVN commit r24641. --- source/simulation2/serialization/DebugSerializer.cpp | 7 +++---- source/simulation2/tests/test_ComponentManager.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/source/simulation2/serialization/DebugSerializer.cpp b/source/simulation2/serialization/DebugSerializer.cpp index 9658080431..ae4c08713f 100644 --- a/source/simulation2/serialization/DebugSerializer.cpp +++ b/source/simulation2/serialization/DebugSerializer.cpp @@ -154,12 +154,11 @@ void CDebugSerializer::PutScriptVal(const char* name, JS::MutableHandleValue val JS::RootedValue serialize(rq.cx); if (m_ScriptInterface.GetProperty(value, "Serialize", &serialize) && !serialize.isNullOrUndefined()) { - // If the value has a Serialize property, pretty-parse that and return the value as a raw string. - // This gives more debug data for components in case of OOS. + // If the value has a Serialize property, pretty-parse that instead. + // (this gives more accurate OOS reports). m_ScriptInterface.CallFunction(value, "Serialize", &serialize); std::string serialized_source = m_ScriptInterface.ToString(&serialize, true); - std::string source = m_ScriptInterface.ToString(value, false); - m_Stream << INDENT << name << ": " << serialized_source << " (raw: " << source << ")\n"; + m_Stream << INDENT << name << ": " << serialized_source << "\n"; } else { diff --git a/source/simulation2/tests/test_ComponentManager.h b/source/simulation2/tests/test_ComponentManager.h index ee601d799d..3d62d0ac49 100644 --- a/source/simulation2/tests/test_ComponentManager.h +++ b/source/simulation2/tests/test_ComponentManager.h @@ -802,7 +802,7 @@ entities:\n\ TestScript1_custom:\n\ comp: {\n\ \"c\": 1\n\ -} (raw: ({y:2}))\n\ +}\n\ \n" );