Skydio / revup

Effortlessly create and manage pull requests without changing branches. Powers a stacked diffs workflow with python and git "plumbing" commands.
https://github.com/Skydio/revup
MIT License
310 stars 59 forks source link

Add a simple LRU cache to common git cmds #108

Closed jerry-skydio closed 1 year ago

jerry-skydio commented 1 year ago

Simple commands such as ref existence, id lookup, and distance lookup are pretty common and could be called with the same args at a higher level such that its difficult to dedupe between calls. To speed things up, add a lru_cache decorator so that later calls are looked up. We don't add this to everything since more complex functions are unlikely to be called with the same args multiple times.

These calls are mostly pure functions since revup generally doesn't change the git database. There are a few exceptions to that, when it runs "reset" for certain commands. In these cases, we empty all caches just to be safe.

Topic: cache Reviewers: brian-k

jerry-skydio commented 1 year ago

Reviews in this chain: └https://github.com/Skydio/revup/pull/108 Add a simple LRU cache to common git cmds  └https://github.com/Skydio/revup/pull/109 git: Switch cherry-pick backend to git merge-tree

jerry-skydio commented 1 year ago
# head base diff date summary
0 2a31f7b1 9a01d118 diff Apr 4 22:23 PM 3 files changed, 10 insertions(+), 8 deletions(-)
1 3905dadc 9a01d118 diff Apr 5 0:19 AM 1 file changed, 7 insertions(+)
2 cb9c8684 9a01d118 diff Apr 5 0:40 AM 3 files changed, 13 insertions(+), 2 deletions(-)
3 5dfb7574 9a01d118 diff Apr 5 0:41 AM 0 files changed
4 02ea972a 9a01d118 diff Apr 5 1:10 AM 1 file changed, 7 insertions(+), 7 deletions(-)
5 ee23a8f5 9a01d118 diff Apr 5 1:11 AM 0 files changed
6 5999441f 9a01d118 diff Apr 5 4:09 AM 0 files changed
7 ee23a8f5 9a01d118 diff Apr 5 22:49 PM 0 files changed