Repository navigation
perf(config): parallel UserConfig + ProjectConfig load - #2543
Merged
Merged
Conversation
Adds `LoadedConfigs::load(&repo)` which loads user config and project config on scoped threads alongside a `project_identifier` cache warm-up. On a cold cache the wall-clock cost is the longest pole (~5ms) instead of the sum (~13ms sequential). Wired into call sites that consume both configs: alias dispatch (`try_alias`/`step_alias`), `wt config alias show`/`dry-run`, `wt hook show`, `resolve_copy_ignored_config`, `CommandEnv::for_action_branchless`, and the picker's post-switch path. User-only sites (`wt step eval`, `for-each`, `prune`, `relocate`, diagnostics) keep direct `UserConfig::load()` so they don't read `wt.toml` or emit project-config warnings. Cold-run trace on `wt <alias>` shows the three spans (`user_config_load`, `project_config_load`, `project_identifier_warm`) overlap on distinct thread ids; `try_alias` total drops from ~33ms to ~26ms. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
worktrunk-bot
approved these changes
May 3, 2026
Merged
max-sixty
added a commit
that referenced
this pull request
May 3, 2026
Cuts v0.47.0. Highlights: - **Integration detection fix** across `wt list`, `wt remove`, `wt merge`, `wt step prune` for the local/upstream-diverged case (#2507, #2513, #2515). - **Faster shell-command dispatch** (~10ms per invocation, 1.49× on trivial aliases) via event-driven signal forwarding (#2537, #2538), plus parallel config load (#2543) and merged cold-start prewarm rev-parse (#2541). - **`wt switch <number>` suggests `pr:N` / `mr:N`** instead of just `--create` (#2516). - **Library API breaking changes**: `RefSnapshot` cutover (#2528, #2530) and the `for-each` direct-exec change (#2465). Full list in `CHANGELOG.md`. See `CHANGELOG.md` for the complete entry. > _This was written by Claude Code on behalf of @max-sixty_ --------- Co-authored-by: Claude <noreply@anthropic.com>
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.
Summary
Adds
LoadedConfigs::load(&repo)which loads user config and project config on scoped threads alongside aproject_identifiercache warm-up. On a cold cache the wall-clock cost is the longest pole (~5ms) instead of the sum (~13ms sequential).Cold-run trace on
wt <alias>shows the three spans (user_config_load,project_config_load,project_identifier_warm) overlap on distinct thread ids;try_aliastotal drops from ~33ms to ~26ms.Where it's used
LoadedConfigs::load(&repo)(need both configs):try_alias/step_aliaswt config alias show/dry-runwt hook showresolve_copy_ignored_configCommandEnv::for_action_branchless(downstreamrun_hookreads project from cache)run_pre_switch_hooksreads project from cache)UserConfig::load()(only user — unchanged):wt step eval,for-each,prune,relocatecommit --show-prompt,show-squash-promptrender_diagnosticsUser-only sites deliberately skip the bundle so they don't read
wt.tomlor emit project-config deprecation/unknown-field warnings on commands that never consume project config.Why a struct method, not a free helper
LoadedConfigs::load(&repo)mirrors the existingUserConfig::load()andProjectConfig::load(&repo, ...)shape. The bundle (LoadedConfigs { user, project }) lives in the library crate (worktrunk::config) and is the canonical way to load both at once.Trade-off (warning ordering)
Both
UserConfig::loadandProjectConfig::loademit deprecation/unknown-field warnings to stderr inline. Running them on sibling threads makes warning order nondeterministic when both files have warnings. No existing test fixture exercises both at once; users with deprecated keys in both files may see varying order across runs. Acceptable trade-off for the parallel savings — buffer-and-replay is a separate refactor.Test plan
cargo test --lib --bins(1682 pass)cargo test --test integration(1589 pass)pre-commit run --all-files(clean)load_aliases37us (vs ~4.9ms before),try_alias~29ms (vs ~33ms baseline)🤖 Generated with Claude Code