From f07ec0e358e0782b4d2b1c752d8eedd8f376281c Mon Sep 17 00:00:00 2001 From: librelad Date: Tue, 26 May 2026 21:32:52 +0100 Subject: [PATCH] fix(lazy-load): exclude function_manifest.sh from the early find-loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The early loop in sourceInitilize() sources every .sh under source/files/ recursively — including the new arrays/function_manifest.sh, which now carries ~860 autoload stub definitions (~50 ms parse cost). Even in eager mode where lazy infrastructure is never touched, every invocation was paying that cost up front. The manifest is only needed in lazy mode, where it's sourced explicitly at the top of the lazy branch. Excluding it from the early loop: - Eager mode: drops the ~50 ms regression introduced by Phase 5. - Lazy mode: unchanged — the explicit source still runs. This brings eager back to the pre-Phase-5 baseline and lets the lazy container-stub gain (skipping sourceScanFiles containers, ~70 ms) show through as a real saving. Signed-off-by: librelad --- scripts/source/loading/initilize_files.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/source/loading/initilize_files.sh b/scripts/source/loading/initilize_files.sh index 2b80528..a5db116 100755 --- a/scripts/source/loading/initilize_files.sh +++ b/scripts/source/loading/initilize_files.sh @@ -16,8 +16,14 @@ sourceInitilize() # Check if the directory exists if [ -d "$file_list_directory" ]; then - # Use find to get a list of all files (excluding directories) in the directory and its subdirectories - local file_list=$(find "$file_list_directory" -type f -name "*.sh") + # Use find to get a list of all files (excluding directories) in the + # directory and its subdirectories. The function_manifest.sh file is + # excluded — it carries ~860 stub function definitions (~50 ms parse + # cost) that are only needed in lazy mode, where it's sourced + # explicitly. Including it here makes every eager-mode invocation pay + # for lazy infrastructure it never uses. + local file_list=$(find "$file_list_directory" -type f -name "*.sh" \ + ! -name "function_manifest.sh") # Loop through each file in the file list while IFS= read -r file; do