Repository navigation
perf(devbox): skip redundant runx, script and state-hash work per env compute - #3056
Open
mikeland73 wants to merge 2 commits into
Open
mikeland73 wants to merge 2 commits into
mikeland73 wants to merge 2 commits into
Conversation
- RunXPaths: don't touch .devbox/virtenv/runx/bin when the project has no runx packages and no leftover links. - Scripts: skip rewriting script files whose contents and mode already match. Keeps the temp-file + rename write (not overwriteFileIfChanged) so the concurrency/ETXTBSY fixes from #3032 and #3037 still hold. - Memoize lockfile.StateStatus on the Devbox for the duration of one ensureStateIsUpToDate[AndComputeEnv] call instead of computing it twice per shellenv. The cache is dropped when the call returns, after the non-Nix refresh, and before any config-changing (non-ensure) mode. Spec item 17 (smaller cleanups), env-compute/run bullets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
[Medium impact] The PR appears safe to merge; the latest changes only correct documentation references.
|
Collaborator
Author
|
@greptileai review Written by Claude on behalf of / prompted by @mikeland73. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the env-compute / run bullets of item 17 ("Smaller cleanups") in
specs/perf-improvements.md.Changes
RunXPaths: fix(devbox): reconcile runx bin dir in place to avoid concurrent races #3019 already made it reconcile.devbox/virtenv/runx/binin place, rewriting only changed links. It now also skips the filesystem entirely when there are no runx packages and no leftover links (most projects).writeScriptFileAtomicskips the write when the existing file already has the same contents and mode0755, sodevbox runno longer rewrites every script. It doesn't useoverwriteFileIfChangedas the spec suggested: that writes in place, and anotherdevboxprocess may be executing the script, which would bring back the races fixed in fix(devbox): make concurrent devbox run safe on shared script files #3032 and fix(shellgen): avoid ETXTBSY when forking while writing scripts #3037.StateStatusmemoization: it was computed twice per shellenv (ensureStateIsUpToDateAndComputeEnv, thenensureStateIsUpToDate). Each run hashes the lockfile, config, print-dev-env cache and nix profile. It's now cached on theDevboxonly for the duration of one such call. The cache is dropped when the call returns, after the non-Nix refresh, and before any non-ensuremode (where the caller changed the config). Thepackages.gochange is a few lines inensureStateIsUpToDate, to stay clear of the concurrent Add/Remove/Update refactor.Out of scope (other PRs): the
FlakeUpdateremoval and prefetch bullets of item 17, items 12–16.Testing
TestRunXPathsWithoutRunXPackages,TestStateStatusCacheDoesNotOutliveCall,TestWriteScriptFileAtomicSkipsUnchangedgo test ./internal/devbox/... ./internal/shellgen/... ./internal/lock/...passgo test -run TestScripts ./testscripts: all 67 pass,python_patch_cudaskipped🤖 Generated with Claude Code