gitext-rs / git-stack

Stacked branch management for Git
Apache License 2.0
496 stars 19 forks source link

perf(git): Cache merge-bases in-memory #217

Closed epage closed 2 years ago

epage commented 2 years ago

In the linux repo with a topic branch off of a very old commit, git stack is taking around 18s. This drops it to 12s. We are doing a lot of repeated merge-base calls as each level has its own version of the question to ask. At first, I was worried about the order of the parameters limiting the value of the cache but we seem to be pretty consistent in the order we provide them.

See #216

arxanas commented 2 years ago

Re. ordering, git-branchless used to always put the lesser OID before the greater one as the cache key.

epage commented 2 years ago

Re. ordering, git-branchless used to always put the lesser OID before the greater one as the cache key.

Yeah, just didn't bother because our ordering is consistent enough though I should go back sometime and check the order so its more resilient.