target / lorri

Your project's nix-env
Apache License 2.0
992 stars 69 forks source link

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

Open mammothbane opened 3 years ago

mammothbane commented 3 years ago

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

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

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