Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

lorri direnv extremely slow with a large number of env vars #491

Open
mammothbane opened this issue Jan 26, 2021 · 0 comments
Open

lorri direnv extremely slow with a large number of env vars #491

mammothbane opened this issue Jan 26, 2021 · 0 comments

Comments

@mammothbane
Copy link

mammothbane commented Jan 26, 2021

Describe the bug
Very high evaluation times for output of lorri direnv with a large number of environment variables. In this example repo, I generate 2000 env vars and the eval takes 10-15s. I.e., every time you enter the repo directory, the shell is nonfunctional for 10-15s. There is a similar amount of overhead every time a change happens -> a nix build occurs.

This overhead is somehow linked to lorri — direnv using eval $(nix print-dev-env) instead of eval $(lorri direnv) takes on the order of a second to complete.

To Reproduce

  • Clone my example repo.
  • direnv allow, let lorri build
  • cd out of/back into the repo dir -- takes on the order of 10-15s for me
  • journalctl --user -eu lorri confirms that this slowness isn't because any nix builds have taken place.

For more quantitative results, from the parent directory of lorri-slow:

  • time direnv exec lorri-slow true
    • on my machine: 14.92s user 0.17s system 99% cpu 15.127 total
  • time nix-shell lorri-slow/shell.nix --run true
    • on my machine: 0.49s user 0.10s system 95% cpu 0.622 total

Expected behavior
lorri direnv to finish evaluating in well under a second if not waiting on nix to build.

Metadata

$ lorri info --shell-file shell.nix
lorri version: 1.2
GC roots exist, shell_gc_root: <elided>
$ uname -a
Linux <hostname elided> 5.4.85 #1-NixOS SMP Mon Dec 21 12:27:07 UTC 2020 x86_64 GNU/Linux
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant