(address . bug-guix@gnu.org)
Hi Guix!
In Guile, -L is a equivalent shorthand for adding to the %load-path
variable. No actual files are evaluated. In Guix, -L actually evaluates
files (at least in some capacity) to look for package definitions,
allowing for uses like $ guix -L . <some_local_package>.
This has a performance impact as channels grow, so it would be nice if
there was an alternative command line flag that matched Guile's
behavior.
To showcase the issue, here's three examples of "building" an
already-built home environment. I would use $ guix repl instead, but -L
in guix repl seems to match Guile's behavior, not Guix's.
Toggle snippet (25 lines)
# Baseline, no load path additions
gibraltar :) rsent$ bash -c 'time guix home build rsent/home/minimal.scm'
/gnu/store/5m062lg4f32j9hlirfkcp5141px6sgkv-home
real 0m9.776s
user 0m22.981s
sys 0m0.233s
# GUILE_LOAD_PATH, within margin of error of baseline
gibraltar :) rsent$ GUILE_LOAD_PATH=. bash -c 'time guix home build rsent/home/minimal.scm'
/gnu/store/5m062lg4f32j9hlirfkcp5141px6sgkv-home
real 0m10.016s
user 0m23.064s
sys 0m0.186s
# -L ., consistently ~25% longer to complete
gibraltar :) rsent$ bash -c 'time guix home build -L . rsent/home/minimal.scm'
/gnu/store/5m062lg4f32j9hlirfkcp5141px6sgkv-home
real 0m12.791s
user 0m29.569s
sys 0m0.247s
At present one can set GUILE_LOAD_PATH manually to work around this
issue. In my opinion this isn't very discoverable. Furthermore, it can't
_cleanly_ handle cases when GUILE_LOAD_PATH is already set or needs
multiple entries. It also makes certain commands with bash builtins
(like time...) awkward since you have to enter a subshell.
--
Take it easy,
Richard Sent
Making my computer weirder one commit at a time.