From 257220e20b2adba35d71ab9c867b2bf2bc655223 Mon Sep 17 00:00:00 2001 From: LemmyCook Date: Wed, 20 Aug 2025 22:54:48 -0400 Subject: [PATCH] Optimization: Don't write settings to disk immediately This avoid excessive IO when a variable changes rapidly (ex: sliders) --- Commons/Settings.qml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 14829c9..8f9cb32 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -70,11 +70,21 @@ Singleton { } } + // Don't write settings to disk immediately + // This avoid excessive IO when a variable changes rapidly (ex: sliders) + Timer { + id: saveTimer + running: false + interval: 1000 + onTriggered: settingsFileView.writeAdapter() + } + FileView { + id: settingsFileView path: settingsFile watchChanges: true onFileChanged: reload() - onAdapterUpdated: writeAdapter() + onAdapterUpdated: saveTimer.start() Component.onCompleted: function () { reload() }