-
Notifications
You must be signed in to change notification settings - Fork 446
Cache the Git remote URL to speed up rendering hyperlinks #1940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Thanks for reporting this! Caching is fine, the slowdown is from libgit2 being overly correct and assuming that the remote url could change while the program is running. |
aeb4fca to
c184e5f
Compare
|
@th1000s Took a while until I had some spare cycles to look at this again, but following your guidance I was able to use a |
|
@dandavison 1) Thank you for delta - it's incredible 2) Any chance you could enable the tests? |
|
Hi @charlievieth -- tests are running! I'm sorry that I personally am finding so little time to work on delta at the moment, but thank you very much for your work here. |
c184e5f to
3e50f42
Compare
|
@dandavison Thank you and I completely understand (I've only recently had the cycles to address my own OSS commits and projects). The For context my rust toolchain is:
Script used to check the delta of
|
|
If you'd like to deal with the clippy complaints then that would be great! I think the best way would be to open a PR for the clippy-related fixes against |
Created #2038 to address the clippy complaints. |
Fix Clippy complaints from running `cargo clippy` and `cargo test`.
This commit speeds up the rendering of hyperlinks by ~55x by caching the Git repo's remote URL instead of fetching it each time a hyperlink is rendered. Fixes dandavison#1939
This commit changes the GitConfig struct to cache the GitRemoteRepo, which speeds up the rendering of hyperlinks by ~55x. Fixes dandavison#1939
3e50f42 to
09b6d7e
Compare
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
GitConfigshould 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 benchmarkingdeltabefore 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)