Skip to content

Implement caching mechanism for diff snippets based on file save timestamp - #4161

Merged
sestinj merged 6 commits into
continuedev:mainfrom
ferenci84:diff_cache
Feb 17, 2025
Merged

sestinj merged 6 commits into
continuedev:mainfrom
ferenci84:diff_cache

Conversation

@ferenci84

@ferenci84 ferenci84 commented Feb 14, 2025 •

Copy link
Copy Markdown
Contributor

Description

Caching mechanism for get diff under VS code.

Bug:
#4130

Testing instructions

Watch git log while typing. After modification, git diff command should be issued only once after saving any file.

Note

Equivalent implementation for IntelliJ need to be implemented. For now, there is a fallback to a 10s cache invalidation

Additional changes fixing underlying issues explained in the above issue

  • Added _getRepositories that will find repositories directly from the vscode.git extension. This didn't really contributed to the problem, but that was a fix I tried, and I believe it's better and less resource-intensive (it doesn't even require async) than the original code.
  • In crawlTypes I removed Promise.all and implemented sequential processing. This consumes my CPU at the same level and takes the same amount of time to finish in my test project (between 1 and 2 minutes), but doesn't block my resources.
  • Increased cache size for executeGotoProvider from 50 to 500. After this change, subsequent runs didn't take minutes to finish, only the first one.
  • After I noticed that the ideSnippets is not used at all in the getSnippets from core/autocomplete/templating/filtering.ts, I disabled in a way that it can be enabled later.

@netlify

netlify Bot commented Feb 14, 2025 •

Copy link
Copy Markdown

✅ Deploy Preview for continuedev canceled.

Name Link
🔨 Latest commit f70f002
🔍 Latest deploy log https://app.netlify.com/sites/continuedev/deploys/67b0934cc446a1000807fa2a

@ferenci84

Copy link
Copy Markdown
Contributor Author

Further changes added to solve the core problem, see my latest comment in #4130

Changes:

  • Added _getRepositories that will find repositories directly from the vscode.git extension. This didn't really contributed to the problem, but that was a fix I tried, and I believe it's better and less resource-intensive (it doesn't even require async) than the original code.
  • In crawlTypes I removed Promise.all and implemented sequential processing. This consumes my CPU at the same level and takes the same amount of time to finish in my test project (between 1 and 2 minutes), but doesn't block my resources.
  • Increased cache size for executeGotoProvider from 50 to 500. After this change, subsequent runs didn't take minutes to finish, only the first one.
  • After I noticed that the ideSnippets is not used at all in the getSnippets from core/autocomplete/templating/filtering.ts, I disabled in a way that it can be enabled later.

@sestinj

sestinj commented Feb 17, 2025

Copy link
Copy Markdown
Contributor

@ferenci84 this is great work, thank you for digging so deeply into the problem!

@sestinj
sestinj merged commit 7fd10c2 into continuedev:main Feb 17, 2025
@github-actions
github-actions Bot deleted the diff_cache branch November 10, 2025 06:04
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