Skip to content

Prototype: Fast/slow path for incremental updates#572

Draft
thomasmarshall wants to merge 1 commit intomainfrom
shape-based-incremental-updates
Draft

Prototype: Fast/slow path for incremental updates#572
thomasmarshall wants to merge 1 commit intomainfrom
shape-based-incremental-updates

Conversation

@thomasmarshall
Copy link
Contributor

This PR adds a very basic incremental update mechanism, similar to what Sorbet does when it chooses between a fast and slow path. If the semantic shape of the document hasn't changed (i.e. no namespaces added or removed) then we don't need to create any new namespace declarations or perform any resolution. Otherwise, we'll do a full re-resolve.

This doesn't do any form of invalidation, so there is no need to do any form of dependency tracking. It's beneficial primarily for simple LSP use-cases, where we want to avoid running expensive resolution when not necessary. For example, if the user is just typing code in the body of a method or adding a new method, there isn't any reason to re-run resolution.

We are very likely missing some cases, but this is a prototype to demonstrate how the fast/slow path approach could work quite straightforwardly in Rubydex. It doesn't achieve what we want to eventually achieve (more granular invalidation and re-resolution) but it makes common case editing more bearable.

This commit adds a very basic incremental update mechanism, similar to
what Sorbet does when it chooses between a fast and slow path. If the
semantic shape of the document hasn't changed (i.e. no namespaces added
or removed) then we don't need to create any new namespace declarations
or perform any resolution. Otherwise, we'll do a full re-resolve.

This doesn't do any form of invalidation, so there is no need to do any
form of dependency tracking. It's beneficial primarily for simple LSP
use-cases, where we want to avoid running expensive resolution when not
necessary. For example, if the user is just typing code in the body of a
method or adding a new method, there isn't any reason to re-run
resolution.

We are very likely missing some cases, but this is a prototype to
demonstrate how the fast/slow path approach could work quite
straightforwardly in Rubydex. It doesn't achieve what we want to
eventually achieve (more granular invalidation and re-resolution) but it
makes common case editing more bearable.
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.

1 participant