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

Only send suggestions updates when type changes #6755

Merged

Conversation

hubertp
Copy link
Contributor

@hubertp hubertp commented May 18, 2023

Pull Request Description

The change adds an additional field to ExpressionUpdates messages sent by ProgramExecutionSupport to indicate if the type of value (or its method pointer) has changed and therefore would potentially require a suggestions' update.

Prior to #3729 that check was done during the instrumentation. However we still want to continue to support "pending expression" functionality therefore SuggestionsHandler will use the additional information to filter only the required expression updates.

Most of the changes are related to adapting our tests to the new field.

Closes #6706.

Important Notes

The associated project now loads and navigates smoothly.
Also attaching a screenshot from the project that illustrates that pending functionality continues to work:
Kazam_screencast_00006.webm

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • [ ] The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

The change adds an additional field to `ExpressionUpdates` messages sent
by `ProgramExecutionSupport` to indicate if the type of value (or its
method pointer) has changed and therefore would potentially require a
suggestions' update.

Prior to #3729 that check was done during the instrumentation. However
we still want to continue to support "pending expression" functionality
therefore `SuggestionsHandler` will use the additional information to
filter only the required expression updates.

Most of the changes are related to adapting our tests to the new field.

Closes #6707.
@hubertp
Copy link
Contributor Author

hubertp commented May 18, 2023

Also appears to help slightly with #6639

@@ -386,6 +386,7 @@ object ProgramExecutionSupport {
Api.ProfilingInfo.ExecutionTime(e.getNanoTimeElapsed)
}.toVector,
value.wasCached(),
value.isTypeChanged() || value.isFunctionCallChanged(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change + filtering in SuggestionsHandler is the gist of this PR. The rest is just noise in tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

Glad that it worked out. One unfortunate thing is that we cannot filter those early in the instrument like it was done originally. But as I understand, we need to propagate them to the language server to handle errors and panics properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, sadly

@@ -265,6 +265,7 @@ final class SuggestionsHandler(
updates.map(u => (u.expressionId, u.expressionType))
)
val types = updates.toSeq
.filter(_.typeChanged)
Copy link
Contributor

Choose a reason for hiding this comment

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

That should do the job 👍

Copy link
Member

@Akirathan Akirathan left a comment

Choose a reason for hiding this comment

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

Nice. Tried opening a mid-size project and the number of suggestionsDatabaseUpdate is lower - before 192 in this PR: 71.

@hubertp hubertp added the CI: Ready to merge This PR is eligible for automatic merge label May 18, 2023
@mergify mergify bot merged commit a32a2ea into develop May 18, 2023
@mergify mergify bot deleted the wip/hubert/6706-frequent-suggestions-on-expression-update branch May 18, 2023 16:44
Procrat added a commit that referenced this pull request May 22, 2023
…t-rename

* develop:
  Widgets, Vector as Column, Viz Fixes and Rename Columns (#6768)
  Implement simple variants of `parse` for the Database backend (#6731)
  Enable `require-jsdoc` lint and add two lints related to React (#6403)
  Decimal/Integer .round and .int #6654 (#6743)
  Set suggestion reexports when serializing the library (#6778)
  Fix file uploading node expression. (#6689)
  Using WarningsLibrary to query for warnings (#6751)
  Implement `cast` for Table and Column (#6711)
  Display Initializing project... message when initializing project (#6661)
  Only send suggestions updates when type changes (#6755)
  sbt runEngineDistribution --debug to ease debuggging (#6745)
  Display "modified at" column on the cloud dashboard (#6687)
  Meta.meta Integer . methods (#6740)
  Show spinner while loading directory (#6714)
  Add cloud dashboard to changelog (#6688)
  Fix list editor panics during insertion (#6540)
  Update bug-report.yml
  Remove project create form (#6710)
  Change full-screen visualisation shortcut to shift-space (#6663)
Procrat added a commit that referenced this pull request May 22, 2023
* develop: (30 commits)
  Widgets, Vector as Column, Viz Fixes and Rename Columns (#6768)
  Implement simple variants of `parse` for the Database backend (#6731)
  Enable `require-jsdoc` lint and add two lints related to React (#6403)
  Decimal/Integer .round and .int #6654 (#6743)
  Set suggestion reexports when serializing the library (#6778)
  Fix file uploading node expression. (#6689)
  Using WarningsLibrary to query for warnings (#6751)
  Implement `cast` for Table and Column (#6711)
  Display Initializing project... message when initializing project (#6661)
  Only send suggestions updates when type changes (#6755)
  sbt runEngineDistribution --debug to ease debuggging (#6745)
  Display "modified at" column on the cloud dashboard (#6687)
  Meta.meta Integer . methods (#6740)
  Show spinner while loading directory (#6714)
  Add cloud dashboard to changelog (#6688)
  Fix list editor panics during insertion (#6540)
  Update bug-report.yml
  Remove project create form (#6710)
  Change full-screen visualisation shortcut to shift-space (#6663)
  Revert "Show spinner when opening/creating a project (#6321)" (#6712)
  ...
mergify bot pushed a commit that referenced this pull request May 29, 2023
Only invalidate the graph editor view at most once per frame. On develop, this saves about 70ms (2%). Testing a recent backend without #6755 as a stress-test, this saves about 5s (45%). This reflects better scalability to large numbers of `SuggestionUpdate` messages.

Fixes #6630.

# Important Notes
- Also fix intermittent profiling failures occurring since the introduction of microtasks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate flood of suggestionsDatabaseUpdate messages on startup
4 participants