diff --git a/scripts/source/load_sources.sh b/scripts/source/load_sources.sh index be70687..465459c 100755 --- a/scripts/source/load_sources.sh +++ b/scripts/source/load_sources.sh @@ -41,9 +41,19 @@ fi # For starting the script if [[ $init_run_flag == "true" ]]; then - # For loading LibrePortal + # For loading LibrePortal as a long-running process (task processor, + # WebUI service). Eager loading wins here — the process keeps running, + # so first call to anything should be hot. LP_LAZY stays unset. sourceCheckFiles "run"; elif [[ $init_run_flag == "false" ]]; then - # For using the CLI + # For one-shot CLI invocations. Default LP_LAZY=1 so short commands + # (`libreportal help`, `peer list`, etc.) only source the ~8 files with + # top-level side effects + the function manifest stubs, deferring the + # ~420 pure function libs until something actually calls them. ~34% + # wall-time savings on a no-op command in measurement (Phase 4 of the + # lazy-load work). Explicit `LP_LAZY=0 libreportal …` still works for + # debugging or for catching a stale manifest. + : "${LP_LAZY:=1}" + export LP_LAZY sourceCheckFiles "cli"; fi \ No newline at end of file