From 3b410fe6d99eeb586c5c915fefa15e7fbc2a1792 Mon Sep 17 00:00:00 2001 From: librelad Date: Tue, 26 May 2026 20:54:38 +0100 Subject: [PATCH] fix(lazy-load): skip manifest itself + files_*.sh arrays from scan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous run had 32 eager files; 24 of them were the auto-generated files_*.sh arrays (only useful to the eager loader) + the manifest itself (which the lazy loader sources explicitly). Eager-sourcing them under lazy mode was pure overhead — ~55ms on the manifest alone (it was being parsed twice, once via the explicit lazy-loader source and once via the LP_EAGER_FILES loop). Down to 8 eager files (the genuinely-side-effecting ones: setup_lock.sh, the two crontab task processors, backup_db.sh, backup_files.sh, docker swap_docker_type.sh, migrate_url_rewrite.sh, cli_debug_commands.sh). The files_*.sh arrays are still sourced by the eager loader's existing path — that's unchanged. Lazy mode just doesn't need them because it never iterates files_libreportal_app[@] / files_libreportal_cli[@]. Signed-off-by: librelad --- .../source/files/arrays/function_manifest.sh | 24 ------------------- .../files/generate_function_manifest.sh | 8 +++++++ 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/scripts/source/files/arrays/function_manifest.sh b/scripts/source/files/arrays/function_manifest.sh index f09e73d..a35b3eb 100644 --- a/scripts/source/files/arrays/function_manifest.sh +++ b/scripts/source/files/arrays/function_manifest.sh @@ -722,30 +722,6 @@ LP_EAGER_FILES=( "docker/type_switcher/swap_docker_type.sh" "migrate/migrate_url_rewrite.sh" "setup/setup_lock.sh" - "source/files/arrays/files_app.sh" - "source/files/arrays/files_backup.sh" - "source/files/arrays/files_checks.sh" - "source/files/arrays/files_cli.sh" - "source/files/arrays/files_config.sh" - "source/files/arrays/files_crontab.sh" - "source/files/arrays/files_database.sh" - "source/files/arrays/files_docker.sh" - "source/files/arrays/files_function.sh" - "source/files/arrays/files_install.sh" - "source/files/arrays/files_logs.sh" - "source/files/arrays/files_menu.sh" - "source/files/arrays/files_migrate.sh" - "source/files/arrays/files_network.sh" - "source/files/arrays/files_os.sh" - "source/files/arrays/files_peer.sh" - "source/files/arrays/files_restore.sh" - "source/files/arrays/files_setup.sh" - "source/files/arrays/files_source.sh" - "source/files/arrays/files_ssh.sh" - "source/files/arrays/files_start.sh" - "source/files/arrays/files_update.sh" - "source/files/arrays/files_webui.sh" - "source/files/arrays/function_manifest.sh" ) # Autoload stubs — one per public function. First call sources the diff --git a/scripts/source/files/generate_function_manifest.sh b/scripts/source/files/generate_function_manifest.sh index 221f8c3..efa1802 100644 --- a/scripts/source/files/generate_function_manifest.sh +++ b/scripts/source/files/generate_function_manifest.sh @@ -55,6 +55,14 @@ should_skip() { case "$rel" in source/files/app_files.sh|source/files/cli_files.sh) return 0 ;; source/files/generate_arrays.sh|source/files/generate_function_manifest.sh) return 0 ;; + # The manifest itself is sourced explicitly by the lazy loader — don't + # also flag it eager, that would double-source (28ms × 2 ≈ wasted 55ms). + source/files/arrays/function_manifest.sh) return 0 ;; + # The files_*.sh arrays are only meaningful for the eager loader's + # iteration. Lazy mode doesn't iterate them, so eager-sourcing them + # under lazy mode is pure overhead. Skip from the scan; the eager + # loader still sources them via its own existing path. + source/files/arrays/files_*.sh) return 0 ;; source/loading/check_files.sh|source/loading/initilize_files.sh|source/loading/scan_files.sh) return 0 ;; source/load_sources.sh|source/paths.sh) return 0 ;; webui/data/generators/webui_test_generate.sh) return 0 ;;