Use std::path::absolute
for hyperlinks on Windows
#2865
+60
−30
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.
Now that
std::path::absolute
is stable, this PR uses it instead of canonicalization for hyperlinks on Windows, the main goal being to avoid unnecessary access to the file system. It bumps the MSRV to 1.79.I ran a couple benchmarks: ripgrep is a bit faster in the usual case, but the gains can be much higher when generating hyperlinks for many files, such as when using
--files
.Usual case
Here's a simple usage example: looking for
hello
in the ripgrep source code:Baseline
PR
Using
--files
And here's a more extreme example: using
--files
on a big repo:Baseline
PR
What's worth noting here is that this PR reduces the system time (certainly spent on accessing the file system for canonicalization):
Note
The baseline and PR binaries have been compiled with the same Rust v1.80.