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.
This commit is contained in:
2026-05-12 19:35:17 +02:00
parent 2684c31f10
commit ae1436b103
+9 -7
View File
@@ -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();
}