Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[perf] Improve install and ensure perf #2076

Merged
merged 5 commits into from
May 23, 2024
Merged

[perf] Improve install and ensure perf #2076

merged 5 commits into from
May 23, 2024

Conversation

mikeland73
Copy link
Contributor

Summary

This improves install and ensure perf by making the following changes:

  • Batch all store path existence checks. (previously we did one by one, each nix ls call is about 50ms)
  • If lockfile has store paths we use them (instead of trying to get them from nix)
  • Fix regression in FillNarInfoCache

How was it tested?

Installed large devbox.json (30+ packages) and used DEVBOX_PRINT_EXEC_TIME and observed almost all "prep" time disappear. prep time is the work devbox does before actually building the packages.

@mikeland73 mikeland73 requested review from gcurtis and savil May 23, 2024 01:00
Copy link
Collaborator

@savil savil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment on lines +99 to +100
// if a store path is used as an installable, the keys will be present even if invalid but
// the values will be null.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh good find!

for _, outValue := range out2 {
res = append(res, outValue.Path)
if outValue.Valid {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏾

@mikeland73 mikeland73 merged commit 70e3e02 into main May 23, 2024
24 checks passed
@mikeland73 mikeland73 deleted the landau/perf branch May 23, 2024 23:57
mikeland73 added a commit that referenced this pull request May 29, 2024
## Summary

Fix regression introduced in
#2076

I misunderstood the API. A null value (in modern API) or a valid: false
(in legacy API) occur when store path doesn't exist. Whether the store
path itself is a valid store path doesn't matter, obviously if it is not
a valid path, it won't be present in the store, but if it's valid and
not installed, it will return null value or valid: false. The users of
this function do not want to ignore these paths.

Edit: This bug is a bit less bad than initially thought. Because we
install non-cached packages in flake, so anything missing would be
installed then.

## How was it tested?

Unit test. 

This is tricky to test. I added a test script that can hopefully catch
this.

Edit: This test doesn't actually catch this because the package ends up
getting installed later on (in the flake). I still think this test is
good to have.
mikeland73 added a commit that referenced this pull request May 30, 2024
## Summary

Addresses issue introduced in 

#2076
and
#2098

Basically we have 2 different uses cases when looking up store paths.
Sometimes we want all store paths (whether installed or not) and in
other cases we only want paths that are in local store. This change
fixes that and adds some testing.

## How was it tested?

unit tests, manual integration test by installing a package that was not
in local store.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants