Skip to content
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

Add a simple LRU cache to common git cmds #108

Merged
merged 1 commit into from
Apr 13, 2023
Merged

Conversation

jerry-skydio
Copy link
Collaborator

@jerry-skydio jerry-skydio commented Apr 5, 2023

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
Copy link
Collaborator Author

jerry-skydio commented Apr 5, 2023

Reviews in this chain:
#108 Add a simple LRU cache to common git cmds
 └#109 git: Switch cherry-pick backend to git merge-tree

@jerry-skydio
Copy link
Collaborator Author

jerry-skydio commented Apr 5, 2023

# 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

@jerry-skydio jerry-skydio force-pushed the jerry/revup/main/cache branch 4 times, most recently from 5dfb757 to 02ea972 Compare April 5, 2023 08:10
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 jerry-skydio force-pushed the jerry/revup/main/cache branch 3 times, most recently from 5999441 to ee23a8f Compare April 6, 2023 05:49
@jerry-skydio jerry-skydio merged commit 3f03c26 into main Apr 13, 2023
@jerry-skydio jerry-skydio deleted the jerry/revup/main/cache branch April 13, 2023 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants