From ae1436b103ed49f27b2cc49f131d0bbdb90784f7 Mon Sep 17 00:00:00 2001 From: Jon Kazama Date: Tue, 12 May 2026 19:35:17 +0200 Subject: [PATCH] perf(config): clone only temp tabs in SaveConfig snapshot/restore (F2.2) The pre-serialization snapshot used to clone the entire Config.Tabs list, then Clear/AddRange the snapshot back. With a typical config of ~30 user-defined tabs plus up to 15 session-only temp tabs, that's a 45-item clone on every save. The persistent tabs never leave the list during this routine, so cloning only the temp subset is functionally identical and keeps the allocation proportional to AutoTellTabsLimit. --- HellionChat/Plugin.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/HellionChat/Plugin.cs b/HellionChat/Plugin.cs index e90b135..3d49324 100755 --- a/HellionChat/Plugin.cs +++ b/HellionChat/Plugin.cs @@ -637,18 +637,20 @@ public sealed class Plugin : IAsyncDalamudPlugin internal void SaveConfig() { - // Strip session-only Auto-Tell-Tabs before serialization; restore after. - var snapshot = Config.Tabs.ToList(); + // Session-only Auto-Tell-Tabs aren't persisted, so they move aside + // before serialization and re-attach after. Cloning only the temp + // subset keeps the allocation proportional to AutoTellTabsLimit + // (<=15) instead of the full tab list. + var tempTabs = Config.Tabs.Where(t => t.IsTempTab).ToList(); Config.Tabs.RemoveAll(t => t.IsTempTab); Interface.SavePluginConfig(Config); - Config.Tabs.Clear(); - Config.Tabs.AddRange(snapshot); + Config.Tabs.AddRange(tempTabs); - // F2.1: snapshot-restore preserves IsTempTab tabs but the mid-step - // RemoveAll bypasses AutoTellTabsService, so re-peg the counter. - // Null-conditional because SaveConfig can fire before Phase-2 init. + // F2.1: the mid-step RemoveAll bypasses AutoTellTabsService, so + // re-peg the counter. Null-conditional because SaveConfig can fire + // before Phase-2 init. AutoTellTabsService?.ResyncTempTabCounter(); }