Skip to content

perf: cache parsed symbol snapshots to avoid redundant tree-sitter parses - #492

Open
sudo-tee wants to merge 3 commits into
mainfrom
perf/symbol_cache
Open

perf: cache parsed symbol snapshots to avoid redundant tree-sitter parses#492
sudo-tee wants to merge 3 commits into
mainfrom
perf/symbol_cache

Conversation

@sudo-tee

Copy link
Copy Markdown
Owner

I was having performances issues with large sessions.

@sudo-tee

Copy link
Copy Markdown
Owner Author

@jensenojs I want to bring your attention here before the tabs.

I was having performance issues with the tokenization on long session, therefore I implemented a LRU cache for it.

Since I don;t know exactly how you use the feature can you let me know if this works as intendend for you ?

@jensenojs

Copy link
Copy Markdown
Collaborator

Tree-sitter's parsing scope shouldn't be very large unless there's a leak. I'll take a closer look when I get home later.

@jensenojs

Copy link
Copy Markdown
Collaborator

Because it is still generally lazy-loaded, the file-list mentioned in the session and the actual Buffers currently open in the session (I'm ashamed to admit I only encountered this issue two days ago, but I've been using only codex for a long time recently) need to be parsed.

It feels like there are at most a dozen or so files? Most of the time? I'm mainly unsure if adding an LRU itself can fundamentally solve this problem. If it can, then implementing an LRU for the whole thing would be great. Based on the buffer we are currently focusing on and the most recently mentioned history.

@sudo-tee

Copy link
Copy Markdown
Owner Author

I'm not sure I understand your comment

@sudo-tee

Copy link
Copy Markdown
Owner Author

I did some profiling with test/data/perf.json

image

This make big sessions open way faster
@jensenojs

Copy link
Copy Markdown
Collaborator

I'm not sure I understand your comment

I didn't follow the problem before, this is a great solution

Additionally, I noticed that you submitted the spec document earlier. Was that intentional or accidental? Regarding today's Tree-sitter feature, I'm wondering if it's necessary to translate my previous spec into English and upload it. What are your thoughts?

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