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

[lockfile] Add hidden lockfile for caching #897

Merged
merged 5 commits into from
Apr 12, 2023
Merged

Conversation

mikeland73
Copy link
Contributor

Summary

This adds a hidden lock file for caching purposes.

Motivation:

This speeds up run/shell by only running ensurePackagesAreInstalled if config or nix profile manifest has changed.

Why hidden?

I'm not ready for this to be an official checked-in lock file. So for now it lives in .devbox and does not get committed to repo.

How was it tested?

In flakes example ran:

devbox run echo 5

and got a speed up of around 66%.

Also tested

cat .devbox/devbox.lock
devbox add hello
cat .devbox/devbox.lock  # does not match original
devbox run hello #success
devbox rm hello
cat .devbox/devbox.lock  # matches original
devbox run hello # error

Copy link
Collaborator

@gcurtis gcurtis left a comment

Choose a reason for hiding this comment

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

I'm excited to have faster startup times!

@mikeland73
Copy link
Contributor Author

@gcurtis I'm going to rename this to possible cache.json since we can't have manifest hash in lock file.

@gcurtis
Copy link
Collaborator

gcurtis commented Apr 12, 2023

@gcurtis I'm going to rename this to possible cache.json since we can't have manifest hash in lock file.

Both names work for me since this is a hidden file. Why doesn't the manifest hash work? I think it should work for the local machine, so as long as it isn't committed it should be okay.

@mikeland73
Copy link
Contributor Author

Both names work for me since this is a hidden file. Why doesn't the manifest hash work? I think it should work for the local machine, so as long as it isn't committed it should be okay.

Yeah for non-committed files manifest is OK. I was just thinking we would eventually move this out of hidden.

@mikeland73 mikeland73 merged commit 4d5d77a into main Apr 12, 2023
9 checks passed
@mikeland73 mikeland73 deleted the landau/lockfile branch April 12, 2023 21:53
mikeland73 added a commit that referenced this pull request Apr 12, 2023
## Summary

Stacked on #897

This significantly improves `run` and `shell` performance (`run` goes
from 500ms -> 150ms without telemetry)

Almost all remaining time for run and shell involves the `exec.Command`
so this is close to as fast as it will get.

## How was it tested?

```bash
devbox add hello
time devbox run which hello
```
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

2 participants