UPSTREAM PR #17563: Update how $NU_LIB_DIRS / $env.NU_LIB_DIRS is handled at startup time#51
UPSTREAM PR #17563: Update how $NU_LIB_DIRS / $env.NU_LIB_DIRS is handled at startup time#51
$NU_LIB_DIRS / $env.NU_LIB_DIRS is handled at startup time#51Conversation
OverviewAnalysis of Nushell binary The update implements NU_LIB_DIRS initialization refactoring to improve library path handling for packagers, adding 22ms to startup time. Performance-critical hot paths (IR execution, pipeline data flow, REPL loop) remain unaffected. Function AnalysisStartup Functions (One-Time Cost):
Standard Library Regressions (External Code):
Network Operation Improvements (External Dependencies):
Other analyzed functions (test utilities, version command, SQLite operations, MCP transport) showed minor changes with negligible impact on typical workloads. Additional FindingsThe NU_LIB_DIRS refactoring prioritizes correctness over raw performance: environment variables are now properly converted to Nushell Values before use, multiple path separators are supported ( 🔎 Full breakdown: Loci Inspector. |
d0a8c7a to
6102c29
Compare
Note
Source pull request: nushell/nushell#17563
This PR changes how (really where)
NU_LIB_DIRSand$env.NU_LIB_DIRSgets set. Specifically, it was written and tested with these two use cases in mind for packagers.Usecase 1 - using the
nu -IUsecase 2 - Using NU_LIB_DIRS
Release notes summary - What our users need to know
Changes how (really where)
NU_LIB_DIRSand$env.NU_LIB_DIRSgets set. Specifically. so they can be used with:nu -clikeNU_LIB_DIRS=/some/path nu -c 'print $env.NU_LIB_DIRS;use some_module *;some_module main'nu -I /some/path -c 'print $env.NU_LIB_DIRS;use some_module *;some_module main'Details
$NU_LIB_DIRSand$env.NU_LIB_DIRSat startup$NU_LIB_DIRSand$env.NU_LIB_DIRScontain defaults and user-specified paths and provided paths append to the list-I'\x1efor path separation as well as allows traditional/some/path1:/some/path2or/some/path1;/some/path2for Windows.Tasks after submitting
Our plan is still to deprecate
$env.NU_LIB_DIRSin favor of const$NU_LIB_DIRSbut until that time, I'm hoping this little fix makes it work for the people who need it.