fix(lazy-load): exclude function_manifest.sh from the early find-loop

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 <librelad@digitalangels.vip>
This commit is contained in:
librelad 2026-05-26 21:32:52 +01:00
parent f5391fe807
commit f07ec0e358

View File

@ -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