gitui icon indicating copy to clipboard operation
gitui copied to clipboard

fix sorting of commits in diff view

Open Joshix-1 opened this issue 2 years ago • 5 comments

Commits were sorted by time in diff view. That's wrong as some people like to commit in the future or past. To see the fix just compare my commit to one before by selecting both and pressing SHIFT+C.

This Pull Request fixes/closes #{issue_num}.

It changes the following:

  • diff view is correct now

I followed the checklist:

  • ( ) I added unittests
  • [x] I ran make check without errors
  • [x] I tested the overall application
  • [x] I tested my changes
  • [x] I added an appropriate item to the changelog

Joshix-1 avatar Jul 06 '23 18:07 Joshix-1

don't know how to write tests for my changes

Joshix-1 avatar Aug 20 '23 18:08 Joshix-1

@extrawurst this is ready for review

Joshix-1 avatar Aug 24 '23 10:08 Joshix-1

4 long months, he waits...

kleenkanteen avatar Jan 03 '24 09:01 kleenkanteen

@Joshix-1 the problem with this change is that it is right in the hotpath for giant repos like linux. can you benchmark the differences with and without your change?

extrawurst avatar Jan 08 '24 10:01 extrawurst

How and what can I benchmark?

Shouldn't it improve performance as commits aren't unneccessarily sorted by date in most cases?

Joshix-1 avatar Jan 08 '24 11:01 Joshix-1

check the log for this line (after the commits are all collected in the log tab):

13:47:30 [TRACE] (4) scopetime: [scopetime/src/lib.rs:41] scopetime: 2360 ms [asyncgit::revlog::async::revlog] @asyncgit/src/revlog.rs:176 (after opening kubernetes repo)

13:57:42 [TRACE] (4) scopetime: [scopetime/src/lib.rs:41] scopetime: 26058 ms [asyncgit::revlog::async::revlog] @asyncgit/src/revlog.rs:176 (after opening linux repo)

extrawurst avatar Feb 12 '24 13:02 extrawurst

and please update to current master to get ready to merge

extrawurst avatar Feb 12 '24 13:02 extrawurst

my gitui is in ~/code/gitui i built it with cargo build --features=timing --release I freshly cloned both repos at their current master, without --filter

Linux:

this pr:

~/code/linux master $ ~/code/gitui/target/release//gitui -l ; grep asyncgit::revlog::async::revlog ~/.cache/gitui/gitui.log
Logging enabled. log written to: "/home/josh/.cache/gitui/gitui.log"
17:39:51 [TRACE] (3) scopetime: [scopetime/src/lib.rs:41] scopetime: 35821 ms [asyncgit::revlog::async::revlog] @asyncgit/src/revlog.rs:176
~/code/linux master $ rm ~/.cache/gitui/gitui.log && ~/code/gitui/target/release//gitui -l && grep asyncgit::revlog::async::revlog ~/.cache/gitui/gitui.log
Logging enabled. log written to: "/home/josh/.cache/gitui/gitui.log"
17:41:54 [TRACE] (4) scopetime: [scopetime/src/lib.rs:41] scopetime: 37788 ms [asyncgit::revlog::async::revlog] @asyncgit/src/revlog.rs:176

current master

~/code/linux master $ rm ~/.cache/gitui/gitui.log && ~/code/gitui/target/release//gitui -l && grep asyncgit::revlog::async::revlog ~/.cache/gitui/gitui.log
Logging enabled. log written to: "/home/josh/.cache/gitui/gitui.log"
17:55:57 [TRACE] (4) scopetime: [scopetime/src/lib.rs:41] scopetime: 41685 ms [asyncgit::revlog::async::revlog] @asyncgit/src/revlog.rs:142
~/code/linux master $ rm ~/.cache/gitui/gitui.log && ~/code/gitui/target/release//gitui -l && grep asyncgit::revlog::async::revlog ~/.cache/gitui/gitui.log
Logging enabled. log written to: "/home/josh/.cache/gitui/gitui.log"
17:56:54 [TRACE] (4) scopetime: [scopetime/src/lib.rs:41] scopetime: 43782 ms [asyncgit::revlog::async::revlog] @asyncgit/src/revlog.rs:142

Kubernetes

this pr

~/code/kubernetes master $ rm ~/.cache/gitui/gitui.log && ~/code/gitui/target/release//gitui -l && grep asyncgit::revlog::async::revlog ~/.cache/gitui/gitui.log
Logging enabled. log written to: "/home/josh/.cache/gitui/gitui.log"
17:47:54 [TRACE] (4) scopetime: [scopetime/src/lib.rs:41] scopetime: 2382 ms [asyncgit::revlog::async::revlog] @asyncgit/src/revlog.rs:176
~/code/kubernetes master $ rm ~/.cache/gitui/gitui.log && ~/code/gitui/target/release//gitui -l && grep asyncgit::revlog::async::revlog ~/.cache/gitui/gitui.log
Logging enabled. log written to: "/home/josh/.cache/gitui/gitui.log"
17:48:38 [TRACE] (3) scopetime: [scopetime/src/lib.rs:41] scopetime: 2364 ms [asyncgit::revlog::async::revlog] @asyncgit/src/revlog.rs:176

current master

~/code/kubernetes master $ rm ~/.cache/gitui/gitui.log && ~/code/gitui/target/release//gitui -l && grep asyncgit::revlog::async::revlog ~/.cache/gitui/gitui.log
Logging enabled. log written to: "/home/josh/.cache/gitui/gitui.log"
17:53:30 [TRACE] (4) scopetime: [scopetime/src/lib.rs:41] scopetime: 2640 ms [asyncgit::revlog::async::revlog] @asyncgit/src/revlog.rs:142
~/code/kubernetes master $ rm ~/.cache/gitui/gitui.log && ~/code/gitui/target/release//gitui -l && grep asyncgit::revlog::async::revlog ~/.cache/gitui/gitui.log
Logging enabled. log written to: "/home/josh/.cache/gitui/gitui.log"
17:53:38 [TRACE] (4) scopetime: [scopetime/src/lib.rs:41] scopetime: 2378 ms [asyncgit::revlog::async::revlog] @asyncgit/src/revlog.rs:142

Joshix-1 avatar Feb 12 '24 17:02 Joshix-1

@Joshix-1 thanks, lgtm!

extrawurst avatar Feb 12 '24 19:02 extrawurst