You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
From observing times for adding and removing packages, I notice that a
lot of time is spent in `syncPackagesToProfile` and most of that is from
`nix.Search`, which is a fairly slow operation. However, from observing
the results, it seems that these should be constant.
For example, here are some search results keyed by the queries:
https://gist.github.com/savil/584c4d9bd6c468aaa8c289265287a23a
Correct me if wrong: all these seem to be constants that won't change,
because the queries we run have the nixpkgs-commit-hash in them.
The general [`nix search`
command](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-search.html)
seems to be slower since the query it accepts is an `installable regex`,
which can match a large number of concrete queries. Furthermore, it
needs to accept queries like`nixpkgs#vim` and figure out which nixpkgs
commit hash this would resolve to. In our case, our queries are much
more specific being of the form `nixpkgs/<commit>#attribute`
## How was it tested?
This effect is more pronounced for packages that are not using
store-paths. This will affect all users who are still on nix < 2.17,
which is a fairly large percentage for now.
I have a devbox global of about 43 packages. For the times below, I ran
`devbox global add vim` (where vim is already in my /nix/store), and did
`export DEVBOX_FEATURE_REMOVE_NIXPKGS=0`
BEFORE:
syncPackagesToProfile takes about 1 min 30+ seconds
AFTER:
syncPackagesToProfile takes 500ms
0 commit comments