TreeSitter Performance And Stability#263
Merged
thecoolwinter merged 11 commits intoCodeEditApp:mainfrom Sep 8, 2024
Merged
Conversation
Atomic property wrapper setters just don't work. Swift grabs the value (with the lock) and then does the operation and then sets the value. There's a small time where the critical section is not protected so we need a class.
austincondiff
previously approved these changes
Sep 7, 2024
0xWDG
previously approved these changes
Sep 7, 2024
tom-ludwig
reviewed
Sep 7, 2024
Sources/CodeEditSourceEditor/TreeSitter/TreeSitterExecutor.swift
Outdated
Show resolved
Hide resolved
tom-ludwig
reviewed
Sep 7, 2024
tom-ludwig
previously approved these changes
Sep 7, 2024
0059a0d
bombardier200
approved these changes
Sep 8, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Stabilizes the highlighting and editing experience for large documents and slow tree-sitter languages. All async operations run using an updated execution manager that is safer, faster, and much easier to use.
Safety Improvements:
HighlightProvidingnow has@MainActormarked callbacks and protocol required functions. In async contexts these will throw a compiler error if not called on the main thread.Performance Improvements:
Highlighter Changes:
HighlightProvidingcallbacks now return aResultobject. If the result is a failure and returns a cancelled error, the highlighter now re-invalidates the queried ranges. This means when highlights are cancelled because of some other async operation, they are always eventually fulfilled.TreeSitter Execution:
Tasks to execute, allowing us to use task cancellation, priority, etc.Related Issues
Checklist
Screenshots
Current editing experience. Note incorrect highlights, extremely slow highlighting and maxed thread use.
Screen.Recording.2024-09-04.at.2.54.16.PM.mov
New editing experience for large files, with metrics:
Screen.Recording.2024-09-04.at.2.51.01.PM.mov