From f882957ebc2225acdf5c2e1c077047f32962a345 Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Tue, 8 Dec 2020 16:59:05 +0100 Subject: [PATCH] Experimentally add priority run when scanning project files Avoid yielding when a first scan is required but seems quite ineffective. --- data/core/init.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/data/core/init.lua b/data/core/init.lua index 373f2108..72065b99 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -55,6 +55,8 @@ function core.open_folder_project(dirname) end local function project_scan_thread() + local priority_run = true + local function diff_files(a, b) if #a ~= #b then return true end for i, v in ipairs(a) do @@ -70,7 +72,7 @@ local function project_scan_thread() end local function get_files(path, t) - coroutine.yield() + if not priority_run then coroutine.yield() end t = t or {} local size_limit = config.file_size_limit * 10e5 local all = system.list_dir(path) or {} @@ -120,11 +122,13 @@ local function project_scan_thread() end core.project_files = t core.redraw = true + priority_run = false end -- wait for next scan if core.switch_project then system.chdir(core.switch_project) + priority_run = true core.switch_project = nil else coroutine.yield(config.project_scan_rate)