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

notebook open optimizations #13488

Merged
merged 8 commits into from
Mar 28, 2024
Merged

Conversation

jonah-iden
Copy link
Contributor

What it does

One larger performance issue for notebooks was the creation of the MonacoEditorModels used by the cell editors. The problem was that they needed to be created when the notebook is first loaded to be available to the extensions but where created one by one which required firing a network request for each single MonacoEditorModel. For a notebook with 100 cells this took up to 500ms.

This PR changes that so that the documents are created seperately between backend and frontend.
In the backend they are created when the document for the notebook itself is created. In the frontend they are created afterwards in createNotebookModel in the notebook-service.ts

Im not sure how nice the solution with rebinding the MonacoTextModelService is. Would love some feedback on this

How to test

Since its about performance, best way to test is to check if working with notebooks is still working.
open, execute cell, change cell, execute again

Follow-ups

Review checklist

Reminder for reviewers

@jonah-iden jonah-iden changed the title Jiden/notebook open optimzations notebook open optimizations Mar 18, 2024
Copy link
Contributor

@jbicker jbicker left a comment

Choose a reason for hiding this comment

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

Works fine! Thanks!

Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
… text models

Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
@jonah-iden jonah-iden force-pushed the jiden/notebook-open-optimzations branch from dd4fa8a to 680b784 Compare March 19, 2024 11:02
@jonah-iden jonah-iden marked this pull request as ready for review March 19, 2024 11:02
@jonah-iden
Copy link
Contributor Author

would love to have a second review on this PR. especially a second opinion on the rebinding of the monaco-text-model-service

@tsmaeder
Copy link
Contributor

would love to have a second review on this PR. especially a second opinion on the rebinding of the monaco-text-model-service

You asked for it ;-) 🤷

Copy link
Contributor

@tsmaeder tsmaeder left a comment

Choose a reason for hiding this comment

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

There are two things that bother me about this PR:

  1. We are overriding a service in the framework itself. This should not be necessary: we should be able refactor the framework until we have the desired configurability. What if a second module in Theia would do the same? That module and the notebook support could not work in parallel (both trying to impose their implementation).
  2. Whether we replicate text documents between front-end and back-end is purely a matter concerning the plugin system. The logic should be confined to the plugin-ext package, IMO.

What we're trying to achieve, in the end, is to optimize the special case where some documents exist implicitly, so no need to replicate them explicitly. This idea is valid. However, we also have other browser-side documents that also are not replicated to the extension side: for example the editors for breakpoint conditions (not sure how that is achieved, though). But if this is a capability multiple clients of the editor service require, we should build a corresponding extension point into the service instead of overriding it.

@jonah-iden
Copy link
Contributor Author

Thanks alot for the feedback! I'll if i can find a nicer solution with contribution point

Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
@jonah-iden
Copy link
Contributor Author

thinking more about this contribution points are a bit overkill for this aren't they? I just added a createUnmanagedModel method to the monaco-text-model-service. That way the service can easily be reused

@tsmaeder
Copy link
Contributor

thinking more about this contribution points are a bit overkill for this aren't they?

A "contribution point" for me is a way to add/change behavior in the framework without replacing the component in the framework. Not a technical term.

@tsmaeder tsmaeder dismissed their stale review March 28, 2024 09:45

My concerns have been addressed.

@jonah-iden jonah-iden merged commit 2c61f6c into master Mar 28, 2024
14 checks passed
@jonah-iden jonah-iden deleted the jiden/notebook-open-optimzations branch March 28, 2024 10:01
@github-actions github-actions bot added this to the 1.48.0 milestone Mar 28, 2024
@msujew msujew added performance issues related to performance notebook issues related to notebooks labels Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notebook issues related to notebooks performance issues related to performance
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants