Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

refactor: simplify caches#448

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
psteinroe merged 14 commits intomainfromchore/simplify-caches
Jul 12, 2025
Merged

refactor: simplify caches#448

psteinroe merged 14 commits intomainfromchore/simplify-caches
Jul 12, 2025

Conversation

psteinroe
Copy link
Collaborator

@psteinroepsteinroe commentedJul 12, 2025
edited
Loading

fixes unbounded memory caches that could lead to oom issues. Document-level caches would accumulate indefinitely as users edited files.

replaced all DashMap usages with appropriate data structures based on access patterns:
Bounded Memory Caches (LRU):

  • PgQueryStore: DashMap → Mutex<LruCache<1000>> - AST parsing cache
  • TreeSitterStore: DashMap → Mutex<LruCache<1000>> - CST parsing cache
  • AnnotationStore: DashMap → Mutex<LruCache<1000>> - Statement annotations cache

Read-Heavy Workloads (RwLock):

  • SchemaCacheManager: DashMap → RwLock - Database schema cache
  • ConnectionManager: DashMap → RwLock - Database connection pool cache
  • WorkspaceServer.documents: DashMap → RwLock - Open document cache

@psteinroepsteinroe changed the titlerefactor: drop change.rs <3refactor: simplify cachesJul 12, 2025
@psteinroepsteinroe marked this pull request as ready for reviewJuly 12, 2025 14:24
Copy link
Collaborator

@juleswritescodejuleswritescode left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Nice :)

Document-level caches would accumulate indefinitely as users edited files.

I'm curious, is this a bug with the lib? Or what happens there?

@psteinroe
Copy link
CollaboratorAuthor

Nice :)

Document-level caches would accumulate indefinitely as users edited files.

I'm curious, is this a bug with the lib? Or what happens there?

this is just a follow-up of the change refactoring. before, we were removing data from the parse caches (pg_query,treesitter) based on the statement changed and statement deleted events that the change handling emitted. Without that, we never delete any parsing results. if a user now starts typing, we keep every parse result of every statement change. this pr fixes that with the LRU cache.

I then researched a bit about dash map and replaced it in other places with a more suitable store.

juleswritescode reacted with hooray emoji

@psteinroepsteinroe changed the base branch fromrefactor/changes tomainJuly 12, 2025 18:26
@psteinroepsteinroe changed the base branch frommain torefactor/changesJuly 12, 2025 18:27
@psteinroepsteinroe changed the base branch fromrefactor/changes tomainJuly 12, 2025 18:28
@psteinroepsteinroe changed the base branch frommain torefactor/changesJuly 12, 2025 18:28
@psteinroepsteinroe changed the base branch fromrefactor/changes tomainJuly 12, 2025 18:29
@psteinroepsteinroe merged commitc06ab00 intomainJul 12, 2025
7 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@juleswritescodejuleswritescodejuleswritescode approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@psteinroe@juleswritescode

[8]ページ先頭

©2009-2025 Movatter.jp