10000 [NO_MERGE][WIP] Startup time by kittaakos · Pull Request #1004 · arduino/arduino-ide · GitHub
[go: up one dir, main page]

Skip to content

[NO_MERGE][WIP] Startup time #1004

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

Closed
wants to merge 45 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
db26148
Dropped Git and the custom layout restorer.
May 20, 2022
5da4b1a
duration decorator.
May 20, 2022
986d597
get ws root withot check.
May 20, 2022
8c95086
Enabled `noImplicitOverride` TS option.
May 20, 2022
307546c
Switched to sketchRef for examples and builtins.
May 20, 2022
77d7416
can disable splash.
May 21, 2022
99caaa8
speed up examples load.
May 21, 2022
9301121
disabled old way of computing the examples.
May 21, 2022
23a1693
do not resolve all sketches as possible ws roots.
May 21, 2022
ba1ff1a
Generate bultin examples structure at build time.
May 21, 2022
5cecaab
load the list widget content only when activated.
May 23, 2022
6179300
reimpl. discovering sketches from the sketchbook
May 23, 2022
17b5646
dropped old way of calculating sketchbook content
May 23, 2022
7e5be19
fixed typo in logs.
May 23, 2022
cf17ce1
changed how to init cli config service.
May 23, 2022
61279fe
run update after show.
May 24, 2022
3e583a7
fall back to new temp sketch URI when no recent WS
8000 May 24, 2022
d5fabc1
customized JSON schema store, editor navigation history, and preferen…
May 24, 2022
fdca524
launch config to start with dev tools + w/o splash
May 24, 2022
dbf635a
defer all menu updates before app is ready.
May 24, 2022
7ccb92b
do not parse the CLI log JSON, use as is.
May 24, 2022
67a456d
fixed port for the LS.
May 24, 2022
dc3b748
deferred contributions to start on app ready.
May 24, 2022
ab163a5
disabled "trick" for deferring menu update.
May 24, 2022
469159e
updated translation files.
May 24, 2022
08f6b27
i18n fixup.
May 24, 2022
c81d1c5
removed native grpc dependencies.
May 24, 2022
71bbeda
Can start the IDE with content tracing.
May 25, 2022
ad76045
Skip loading extensions for the Theia about dialog
May 25, 2022
47620ef
Defer running the FW updates.
May 25, 2022
bc3aee6
Do not require the current window on IDE2 start.
May 25, 2022
313c96c
Do not explicitly initialize the layout on start.
May 25, 2022
68afacf
Added missing protobuf dep.
May 27, 2022
c7f2f4f
asynchronous core and lib index update.
May 27, 2022
e27b9f1
:lipstick: improved dev comments.
May 27, 2022
79503ef
removed debug log.
May 27, 2022
8ffee32
run core and lib index updates parallel.
May 27, 2022
efe7399
Use nightly (20220527) CLI and 2.2.0 FW uploader.
May 27, 2022
05af641
Defer loading boards until the app is ready.
May 27, 2022
b947be0
Open devtools when tracing.
May 27, 2022
2fbf3cb
Resolve and cache current sketch.
May 27, 2022
0e4881c
Reverted titleBarStyling for Windows/Linux.
May 31, 2022
644bf14
workaround for the non realpath.
May 31, 2022
ab56005
Relaxed prettier on Windows.
Jun 1, 2022
8a04d47
Workaround for non-realpaths on Windows.
Jun 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
defer all menu updates before app is ready.
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
  • Loading branch information
Akos Kitta committed May 25, 2022
commit dbf635a26699bb6dc9258a6027bb4d18f8c29f0a
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { injectable } from '@theia/core/shared/inversify';
import { inject, injectable } from '@theia/core/shared/inversify';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { isOSX } from '@theia/core/lib/common/os';
import {
Expand All @@ -14,9 +14,26 @@ import {
ArduinoMenus,
PlaceholderMenuNode,
} from '../../../browser/menu/arduino-menus';
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';

@injectable()
export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
@inject(FrontendApplicationStateService)
private readonly appStateService: FrontendApplicationStateService;

private appReady = false;
private updateWhenReady = false;

override postConstruct(): void {
super.postConstruct();
this.appStateService.reachedState('ready').then(() => {
this.appReady = true;
if (this.updateWhenReady) {
this.setMenuBar();
}
});
}

override createElectronMenuBar(): Electron.Menu {
this._toggledCommands.clear(); // https://github.com/eclipse-theia/theia/issues/8977
const menuModel = this.menuProvider.getMenu(MAIN_MENU_BAR);
Expand All @@ -30,6 +47,13 @@ export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
}

override async setMenuBar(): Promise<void> {
// Avoid updating menu items when the app is not ready.
// Getting the current electron window is not free and synchronous.
// Here, we defer all menu update requests, and fire one when the app is ready.
if (!this.appReady) {
this.updateWhenReady = true;
return;
}
await this.preferencesService.ready;
const createdMenuBar = this.createElectronMenuBar();
if (isOSX) {
Expand All @@ -39,7 +63,10 @@ export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
}
}

override createElectronContextMenu(menuPath: MenuPath, args?: any[]): Electron.Menu {
override createElectronContextMenu(
menuPath: MenuPath,
args?: any[]
): Electron.Menu {
const menuModel = this.menuProvider.getMenu(menuPath);
const template = this.fillMenuTemplate([], menuModel, args, {
showDisabled: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { injectable } from '@theia/core/shared/inversify';
import { inject, injectable } from '@theia/core/shared/inversify';
import { CommandRegistry } from '@theia/core/lib/common/command';
import { MenuModelRegistry } from '@theia/core/lib/common/menu';
import { KeybindingRegistry } from '@theia/core/lib/browser/keybinding';
Expand All @@ -7,19 +7,41 @@ import {
ElectronCommands,
} from '@theia/core/lib/electron-browser/menu/electron-menu-contribution';
import { MainMenuManager } from '../../../common/main-menu-manager';
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
import { FrontendApplication } from '@theia/core/lib/browser';

@injectable()
export class ElectronMenuContribution
extends TheiaElectronMenuContribution
implements MainMenuManager
{
@inject(FrontendApplicationStateService)
private readonly appStateService: FrontendApplicationStateService;

private appReady = false;
private updateWhenReady = false;

override onStart(app: FrontendApplication): void {
super.onStart(app);
this.appStateService.reachedState('ready').then(() => {
this.appReady = true;
if (this.updateWhenReady) {
this.update();
}
});
}

protected override hideTopPanel(): void {
// NOOP
// We reuse the `div` for the Arduino toolbar.
}

update(): void {
(this as any).setMenu();
if (this.appReady) {
(this as any).setMenu();
} else {
this.updateWhenReady = true;
}
}

override registerCommands(registry: CommandRegistry): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
bind(ElectronMenuContribution).toSelf().inSingletonScope();
bind(MainMenuManager).toService(ElectronMenuContribution);
rebind(TheiaElectronMenuContribution).to(ElectronMenuContribution);
bind(ElectronMainMenuFactory).toSelf().inRequestScope();
bind(ElectronMainMenuFactory).toSelf().inSingletonScope();
rebind(TheiaElectronMainMenuFactory).toService(ElectronMainMenuFactory);
8000 bind(ElectronWindowService).toSelf().inSingletonScope();
rebind(WindowService).toService(ElectronWindowService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ const WORKSPACES = 'workspaces';
const APP_STARTED_WITH_NOSPLASH =
typeof process !== 'undefined' && process.argv.indexOf('--nosplash') !== -1;

/**
* If the app is started with `--open-devtools` argument, the `Dev Tools` will be opened.
*/
const APP_STARTED_WITH_DEV_TOOLS =
typeof process !== 'undefined' && process.argv.indexOf('--open-devtools') !== -1;

@injectable()
export class ElectronMainApplication extends TheiaElectronMainApplication {
protected startup = false;
Expand Down Expand Up @@ -243,10 +249,22 @@ export class ElectronMainApplication extends TheiaElectronMainApplication {
options: TheiaBrowserWindowOptions
): Promise<BrowserWindow> {
const electronWindow = await super.createWindow(options);
if (APP_STARTED_WITH_DEV_TOOLS) {
electronWindow.webContents.openDevTools({ mode: 'undocked' });
}
this.attachListenersToWindow(electronWindow);
return electronWindow;
}

protected override getDefaultOptions(): TheiaBrowserWindowOptions {
const options = super.getDefaultOptions();
if (!options.webPreferences) {
options.webPreferences = {};
}
options.webPreferences.v8CacheOptions = 'bypassHeatCheck'; // TODO: verify this. VS Code use this V8 option.
return options;
}

private attachListenersToWindow(electronWindow: BrowserWindow) {
electronWindow.webContents.on(
'new-window',
Expand Down
0