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

Discussion : Improving Startup Time #472

Closed
lovelyjuice opened this issue Dec 16, 2017 · 8 comments
Closed

Discussion : Improving Startup Time #472

lovelyjuice opened this issue Dec 16, 2017 · 8 comments

Comments

@lovelyjuice
Copy link

  • Extension Name: code-settings-sync
  • Extension Version: 2.8.7
  • OS Version: Windows_NT x64 10.0.16299
  • VSCode version: 1.19.0

We have written the needed data into your clipboard. Please paste:

{
	"activationTimes": {
		"startup": true,
		"codeLoadingTime": 346,
		"activateCallTime": 1,
		"activateResolvedTime": 261,
		"activationEvent": "*"
	}
}

default

Is it possible that the plugin was partly loaded at the vscode starting up, and then entirely loaded when I use it to synchonize my settings?

@lovelyjuice lovelyjuice changed the title Lazy loading the most of the code Lazy loading most of the code Dec 16, 2017
@shanalikhan
Copy link
Owner

can you share your settings sync settings

@lovelyjuice
Copy link
Author

@shanalikhan

{ 
    "sync.gist": "ae956d6743ce0053f3bcb198ff6083cb",
    "sync.lastUpload": "",
    "sync.autoUpload": false,
    "sync.quietSync": false,
    "sync.autoDownload": false,
    "sync.lastDownload": "2017-12-17T09:37:53.357Z",
    "sync.forceDownload": false,
    "sync.anonymousGist": false,
    "sync.host": "",
    "sync.pathPrefix": "",
    "sync.askGistName": false
}

That's all settings about settings sync in my user settings file

@shanalikhan shanalikhan changed the title Lazy loading most of the code Discussion : Improving Startup Time Jan 3, 2018
@shanalikhan
Copy link
Owner

I have renamed this thread as discussion and open for pull request from anyone having ideas to improve the startup.
Feel free to discuss here.

await common.StartMigrationProcess();

let startUpSetting: ExtensionConfig = await common.GetSettings();

let startUpCustomSetting: CustomSettings = await common.GetCustomSettings();

On startup, currently these things are performed:

  1. Migration Process to update the versions and settings
  2. Read across settings to allow auto upload and download on startup

@axetroy
Copy link
Contributor

axetroy commented Jul 21, 2018

@shanalikhan
I found that in source code.

    "activationEvents": [
        "*",
        "onCommand:extension.updateSettings",
        "onCommand:extension.downloadSettings",
        "onCommand:extension.resetSettings",
        "onCommand:extension.HowSettings",
        "onCommand:extension.otherOptions"
    ],

It means the extension is always be activated.

I know this may be the function of automatically synchronizing settings when starting VSCode.

And we have to consider that: Do we really need to sync automatically?

So, here is my solution:

  1. Turn off auto download. BREAKING CHANGE
  2. Optimized activate function

Here are some sync method will blocking thread in activate function.

let lockExist: boolean = await FileService.FileExists(en.FILE_SYNC_LOCK);
if (!lockExist) {
  fs.closeSync(fs.openSync(en.FILE_SYNC_LOCK, 'w'));
}

let locked: boolean = lockfile.checkSync(en.FILE_SYNC_LOCK);
if (locked) {
  lockfile.unlockSync(en.FILE_SYNC_LOCK);
}

@shanalikhan
Copy link
Owner

Do we really need to sync automatically? Turn off auto download. BREAKING CHANGE

Yes Settings sync needs to supports auto upload and auto download features.
They are turned off by default but user can set it ON and use that.
In activation it checks either those modes are on or off and then perform the functions if found ON

@axetroy
Copy link
Contributor

axetroy commented Jul 21, 2018

@shanalikhan

I didn't mean this.

I mean. set activationEvents: ["*"] then extension will always run activation function even user don't need it really. and activation function takes times to load. Slow down the speed of VSCode.

The best situation is: when I need it and when it runs.

I know why we can't remove it. because it required by auto download setting when VSCode startup

so, what I mean is: manual or automatic sync

If manual: We can remove activationEvents: ["*"]. the extension only run when it be trigger command.

If automatic: extension always run when VSCdoe startup

@shanalikhan
Copy link
Owner

Well, Lets keep this automatic for now.

shanalikhan pushed a commit that referenced this issue Aug 6, 2018
shanalikhan added a commit that referenced this issue Aug 26, 2018
* german localization

* corrected naming of locale

* german localization

* corrected naming of locale

* fix: missing partial i18n translation

* fix: missing partial i18n translation

* fix: add missing key for German language file

* fix: typo

* Minor Wording Changes

The text on some parts looked strange and not correct, thought I'd update a few for grammar and looks.

* chore: update .gitignore

* chore: add tslint and prettier rules

* chore: add format script

* chore: update teslint rules to make it defined mutilple class in one file

* chore: run tslint before publish extension

* refactor: format the code with prettier

* chore: update tsconfig and tslint

* refactor: refactor utils.ts

* refactor: refactor localize.ts

* refactor: refactor setting.ts

* refactor: refactor environmentPath.ts

* refactor: refactor fileService.ts

* chore: update teslint rules

* refactor: replace github package with @octokit/rest

* chore: update teslint rules

* refactor: refactor commons.ts

* refactor: refactor pluginService.ts

* refactor: extension.ts

* feat: replace fs module with fs-extra, and use async await instead of callback style

* feat: update deps for vscode/typescript/adm-zip/tslint

* refactor: refactor callback style with async await

* remove unused dependencies ncp and rimraf, use fs-extra instead

* fix: invalid @octokit/rest constructor options

* chore: update travis script

* fix: lstat should be async no sync

* fix: user agent for proxy

* pref: improve performance when start up. use async instead of sync method #472

* fix: implement promisify and fix lockfile

* feat: use lockfile instead of proper-lockfile.

* pref: improve performance

* refactor: add sync class and clean up extension file. it should improve startup performance #472

* refactor: add lockfile.ts

* fix: typo ShowSummaryOutput

* refactor: refactor download function

* fix: lockfile

* refactor: rename 'en' to 'env'

* refactor: remove unused activationEvents

* refactor: refactor upload logic, make it clean

* style: rename lockfile function name, make it same style with other

* refactor: sync advance options

* chore: not allow unuser locals and params. make it clean

* refactor: remove unused local and params

* refactor: remove unneed await

* pref: improve localize performance, init when extension be actived

* fix: make sure resolve language merger with default language.

* Update tutorial message

* Fix slack img

* Update path to imgur link

* Update tutorial link again

* Extension Installation CLI Added
TSLint Improved
#434
#590
#513
#337

* Summary improved

* Github Api Code Improvements

Anonymous Gist Code Removed
Initializtion in contructor
github api updated
proxy addition
github enterprise support updated

* Ignored extensions can be accidentally deleted if removeExtensions is enabled. (#604)

* Fix for #516

* Update to fix `ignoredExtensions` where extensions were deleted if `removeExtensions` was enabled.

* #604

* Extension summary

#577

* Gist Name change
#513

* #611

* fix: error translation

* #611 - Changelog

CLI Improvements

* #611

* #611
@shanalikhan
Copy link
Owner

Startup Time in Linux :

startup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants