-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Performance improvements for initialization #6172
Conversation
ad2492e
to
158eaa3
Compare
371f968
to
4587669
Compare
|
4587669
to
3e4819b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't looked at the code, only did a comparison before and after the change:
Tests (3 Tests / Scenario)
Use Case | Avg Before (sec) | Avg After (sec) | Avg Improvement (sec) | Avg % Improvement |
---|---|---|---|---|
No workspace | 1.642 |
1.514 |
-0.128 👍 |
~8% improvement |
With workspace (theia + views open) - browser |
6.015 |
3.109 |
-2.906 👍 |
~48% improvement |
With workspace (theia + views open) - electron |
6.418 |
3.941 |
-2.477 👍 |
~39% improvement |
Additional Info
I modified the following code on master
and this pr
to capture the times:
async start(): Promise<void> {
const start = new Date();
await this.startContributions();
this.stateService.state = 'started_contributions';
const host = await this.getHost();
this.attachShell(host);
await new Promise(resolve => requestAnimationFrame(() => resolve()));
this.stateService.state = 'attached_shell';
await this.initializeLayout();
this.stateService.state = 'initialized_layout';
await this.fireOnDidInitializeLayout();
await this.revealShell(host);
this.registerEventListeners();
this.stateService.state = 'ready';
const end = new Date();
console.log(`total time till ready: ${(end.getTime() - start.getTime()) / 1000} sec`);
}
packages/core/src/browser/preferences/preference-service.spec.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very cool that we can simplify and speed up configurations, but i am not sure about some changes, please see comments
packages/core/src/browser/preferences/preference-contribution.ts
Outdated
Show resolved
Hide resolved
2b90d43
to
e16d80d
Compare
@vince-fugnitto thanks for the measurements. If you put a bunch of VS code extensions into the mix it becomes even more visible. Also there's lots of scripting going on that is not strictly blocking the frontend startup, but it makes the browser busy for the first seconds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything works nicely except getEOL
.
I wonder whether we can remove updating editor options: theia/packages/monaco/src/browser/monaco-editor-provider.ts Lines 158 to 169 in e16d80d
Since we hook our preferences into the configuration service, maybe Monaco can react to changes from the configuration service and update editors already without us doing the double work. It could be investigated separately. |
I tried and it didn't seem to work. But of course someone could look into it. |
Signed-off-by: Sven Efftinge <sven.efftinge@typefox.io>
e16d80d
to
4ba6949
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getEOL
works nicely now too!
What it does
Avoid some heavy scripting during loading.
getPreferences
repeatedly on many small changes during loading.The main change is that I have replaced taking copies of preferences and keeping them in-sync with using a proxy that directly uses the underlying data.
Also this PR cleans up and simplifies the test for the preference-service and preference-proxy.
How to test
Measure performance for scripting during load before and after the change & compare.
Review checklist
Reminder for reviewers