Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch module change events #931

Merged
merged 1 commit into from
May 31, 2022
Merged

Batch module change events #931

merged 1 commit into from
May 31, 2022

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented May 26, 2022

Closes #925

Notes

I have also left some TODOs in a few places as I believe we can further reduce the amount of events sent, but I didn't want to do it all in one PR.

This already reduces notifications for a simple root module w/ 1 submodule from 54 (18 workspace/semanticTokens/refresh + 18 client.refreshModuleCalls + 18 client.refreshModuleProviders) down to 3, assuming all operations finish within 1 second or earlier.

How? A new notifier package along with a module_changes memdb table is responsible for batching module changes. The "barrier" for releasing a batch is either elapsed 1 second from the first change or no queued/running jobs involving the module (whatever comes first).

Data Flow

For simplicity, diagrams only represent semantic token refreshing, but in reality there's 4 more event types which would each potentially result in similar amount of refresh notifications sent.

Before

Module Hooks Problem

After

Module Hooks Problem (1)

Log Before

https://gist.github.com/radeksimko/6d0901d6a65f79386e87a7450bfcad13#file-before-log

Log After

https://gist.github.com/radeksimko/6d0901d6a65f79386e87a7450bfcad13#file-after-log

@radeksimko radeksimko added enhancement New feature or request technical-debt labels May 26, 2022
@radeksimko radeksimko added this to the v0.28.0 milestone May 26, 2022
@radeksimko radeksimko force-pushed the f-module-change-batches branch 5 times, most recently from 515641b to 70b9f34 Compare May 27, 2022 09:25
@radeksimko radeksimko marked this pull request as ready for review May 27, 2022 09:32
@radeksimko radeksimko requested a review from a team as a code owner May 27, 2022 09:32
Copy link
Contributor

@jpogran jpogran left a comment

Choose a reason for hiding this comment

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

😍

@radeksimko radeksimko merged commit 2952937 into main May 31, 2022
@radeksimko radeksimko deleted the f-module-change-batches branch May 31, 2022 15:31
@github-actions
Copy link

github-actions bot commented Jul 1, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request technical-debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reduce noise & improve performance of module hooks
2 participants