perf(fish): migrate FORGIT_ vars without spawning subprocesses#543
Open
AllanZyne wants to merge 1 commit into
Open
perf(fish): migrate FORGIT_ vars without spawning subprocesses#543AllanZyne wants to merge 1 commit into
AllanZyne wants to merge 1 commit into
Conversation
The backwards-compatibility block that exports unexported FORGIT_ config variables ran `set | awk | grep` plus a `set -x | grep` for every variable, forking multiple external processes on every interactive fish startup. Replace the pipeline with fish's built-in `set -n`/`set -xn` and `string match`, which run in-process. Behavior is unchanged: unexported FORGIT_ variables are still detected, warned about, and exported; nothing is emitted when all variables are already exported. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe FORGIT_ variable export-detection logic in the Fish plugin config was rewritten to use native Fish built-ins (set -n, set -xn, string match -qr) instead of an external pipeline of set, awk, grep, and while read. ChangesVariable Export Refactor
Estimated code review effort: 2 (Simple) | ~10 minutes Compact metadata: Lines changed: +2/-2 | Base: e0c7b84 | Head: f147179 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
What
The backwards-compatibility block in
conf.d/forgit.plugin.fishthat exports unexportedFORGIT_config variables used a shell pipeline:This forks
awkandgrep(once for the list, then agrepper variable) on every interactive fish startup. I replaced it with fish's built-inset -n/set -xn+string match, which run in-process:Why
Pure startup-speed win — no external processes spawned for this block anymore. On my machine the block's cost dropped from ~2.5ms to ~1.5ms; the real benefit is eliminating the per-variable subprocess fork, which scales with how many
FORGIT_vars a user has set.Behavior
Unchanged. Verified:
FORGIT_variables are still detected, warned about, and exported.FORGIT_variables are already exported.The anchored
^FORGIT_match onset -noutput (one name per line) is equivalent to the previousgrep FORGIT_, just without the substring ambiguity.Testing
fish conf.d/forgit.plugin.fish— parses clean🤖 Generated with Claude Code
Summary by CodeRabbit
FORGIT_environment settings so they are exported more reliably.