Cache the Git remote URL to speed up rendering hyperlinks #1940
+46
−22
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.
This commit speeds up the rendering of hyperlinks by ~47x by caching the Git repos remote URL instead of fetching it each time a hyperlink is rendered.
Fixes #1939
Note
I am very new to Rust so I am very open to feedback and completely understand if you want to rewrite or abandon this entire PR (especially if for some reason the remote URL should not be cached). Additionally, I think the
GitConfig
should be responsible for storing the cached remote, but struggled to make that work due to borrowing, lifetimes, mutability, etc.Benchmarks
The below benchmarks were ran in the root of Linux v6.12. We use
head -c $((128 * 1024 * 1024))
to limit the amount of Git log data since otherwise benchmarkingdelta
before this change takes a very long time.TLDR: This change makes processing 128Mib of Git log output take 3.7 seconds instead of 176.1 seconds.
Without git remote caching
With git remote caching (this change)