Avoid a second WSL launch for common path output#158
Open
camjac251 wants to merge 3 commits into
Open
Conversation
The nightly-only harness was not runnable in the repository's normal Windows cross-target workflow. Use a self-contained executable harness that fails on invalid runs and reports repeatable timing statistics.
Tests previously assumed a checkout named `wslgit` and a Bash login shell. Derive both values from the active checkout and WSL environment so isolated worktrees exercise the same behavior reliably.
Output path conversion launched a second WSL process after every Git command. Convert paths directly when the active UNC distribution or Windows drive proves the mapping, while retaining the existing fallback for ambiguous paths and preserving non-UTF-8 output.
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
Problem
Commands whose output contains absolute paths currently launch WSL again to run
wslpath. That second process is a large part of the wrapper's latency. A directconversion is only safe when the current Windows working directory proves the
distribution or drive mapping.
Implementation
The wrapper now derives either the active WSL UNC prefix or the Windows drive
from the working directory. It uses that evidence to translate matching output
in process. Unknown mount drives and other ambiguous paths retain the existing
wslpathfallback, including the selected distribution.The benchmark now runs on stable Rust, resolves the exact Cargo-built binary,
warms up each case, rejects failed or empty runs, and supports
--iterations <N>.Benchmark
In a representative 10-iteration run of the same output-translation case, the
mean fell from 428.02 ms to 333.66 ms: 94.36 ms, or 22.0%. End-to-end timings
remain dominated by Windows/WSL process startup and vary between runs.
Verification
cargo test --target x86_64-pc-windows-gnu -- --test-threads=1cargo bench --target x86_64-pc-windows-gnu --bench benchmark -- --iterations 1cargo build --release --target x86_64-pc-windows-gnucargo fmt --all -- --checkcargo clippy --target x86_64-pc-windows-gnu --all-targetsgit diff --check