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

[Perf] Use IConfigurationChangeEvent#affectsConfiguration #169806

Closed
20 tasks done
jrieken opened this issue Dec 22, 2022 · 5 comments
Closed
20 tasks done

[Perf] Use IConfigurationChangeEvent#affectsConfiguration #169806

jrieken opened this issue Dec 22, 2022 · 5 comments
Labels
Milestone

Comments

@jrieken
Copy link
Member

jrieken commented Dec 22, 2022

related #168639

The configuration service encapsulates all our configuration settings (~750 keys) and its event fires whenever any of them change. Naturally this service has many listener. This combination means all listeners should be conservative and avoid unnecessary work, e.g a listener that's interested in the foo.bar setting shouldn't do something when the bazz.bazz setting changes. For that the IConfigurationChangeEvent#affectsConfiguration-util exists. It allows to quickly check if an event affects "your" setting, this is a good sample of being conservative.

The following list (is hopefully complete) and all listeners that unconditionally do work when any configuration changes. This is wasteful and esp hurtful during startup (when all settings are registered)


  • src/vs/platform/list/browser/listService.ts @joaomoreno

    • 686, 49: configurationService.onDidChangeConfiguration(() => {
  • src/vs/platform/quickinput/browser/commandsQuickAccess.ts @bpasero

    • 221, 44: configurationService.onDidChangeConfiguration(() => this.updateConfiguration()));
  • src/vs/platform/request/node/requestService.ts @sandy081

    • 56, 39: configurationService.onDidChangeConfiguration(() => this.configure(configurationService.getValue()), this));
  • src/vs/platform/telemetry/common/telemetryService.ts @lramos15

    • 68, 30: _configurationService.onDidChangeConfiguration(this._updateTelemetryLevel, this, this._disposables);
  • src/vs/platform/telemetry/common/telemetryUtils.ts @lramos15

    • 94, 30: configurationService.onDidChangeConfiguration(event => {
  • src/vs/platform/windows/electron-main/windowImpl.ts @chrmarti @sbatten

    • 619, 44: configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(e)));
  • src/vs/workbench/browser/layout.ts @sbatten

    • 277, 44: configurationService.onDidChangeConfiguration(() => this.doUpdateLayoutConfiguration()));
  • src/vs/workbench/browser/workbench.ts @bpasero

    • 227, 39: configurationService.onDidChangeConfiguration(() => this.setFontAliasing(configurationService)));
  • src/vs/workbench/common/editor/editorGroupModel.ts @bpasero

    • 210, 44: configurationService.onDidChangeConfiguration(() => this.onConfigurationUpdated()));
  • src/vs/workbench/contrib/localHistory/browser/localHistoryTimeline.ts @bpasero

    • 88, 44: configurationService.onDidChangeConfiguration(e => {
  • src/vs/workbench/contrib/markers/browser/markersFileDecorations.ts @sandy081

    • 69, 31: _configurationService.onDidChangeConfiguration(this._updateEnablement, this),
  • src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.ts @hediet

    • 25, 29: configurationService.onDidChangeConfiguration,
  • src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.ts @hediet

    • 63, 29: configurationService.onDidChangeConfiguration,
      68, 29: configurationService.onDidChangeConfiguration,
      73, 29: configurationService.onDidChangeConfiguration,
  • src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.ts @hediet

    • 102, 29: configurationService.onDidChangeConfiguration,
  • src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.ts @hediet

    • 89, 29: configurationService.onDidChangeConfiguration,
  • src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts @bpasero

    • 60, 44: configurationService.onDidChangeConfiguration(e => this.onConfigurationChange(this.configurationService.getValue(), e)));
  • src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts @meganrogge

    • 287, 45: _configurationService.onDidChangeConfiguration(() => {
  • src/vs/workbench/contrib/testing/browser/testingExplorerView.ts @connor4312

    • 570, 39: configurationService.onDidChangeConfiguration(() => {
      575, 39: configurationService.onDidChangeConfiguration(() => {
  • src/vs/workbench/contrib/welcomeWalkthrough/browser/walkThroughPart.ts @bhavyaus

    • 358, 61: configurationService.onDidChangeConfiguration(() => {
  • src/vs/workbench/services/editor/browser/editorService.ts @bpasero

    • 102, 44: configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(this.configurationService.getValue())));
@jrieken jrieken added this to the January 2023 milestone Dec 22, 2022
@jrieken jrieken added debt Code quality issues perf-bloat labels Dec 22, 2022
sandy081 added a commit that referenced this issue Dec 22, 2022
sandy081 added a commit that referenced this issue Dec 22, 2022
#169806 - use affectsConfiguration
@sandy081 sandy081 removed their assignment Dec 22, 2022
@lramos15 lramos15 assigned bhavyaus and unassigned lramos15 Dec 22, 2022
@lramos15
Copy link
Member

telemetryUtils.ts must remain an unconditional listener because it records anytime the settings change to gain a better understanding of what settings user's are adjusting.

@jrieken
Copy link
Member Author

jrieken commented Dec 22, 2022

@lramos15 makes sense but you could debounce it and merge the listening since you being called repeated during startup

@bpasero
Copy link
Member

bpasero commented Jan 9, 2023

Noticed the configuration listener in editor to be quite expensive, blocking startup:

image

Refs:

this._register(this._configurationService.onDidChangeConfiguration(() => this._updateModelOptions()));

@bpasero
Copy link
Member

bpasero commented Jan 10, 2023

Ping to remaining owners @sbatten @hediet @chrmarti @meganrogge

@bpasero
Copy link
Member

bpasero commented Jan 10, 2023

Noticed a few more, because ITextResourceConfigurationService wraps around IConfigurationService and thus was not part of the list above: #170975

meganrogge added a commit that referenced this issue Jan 10, 2023
@meganrogge meganrogge removed their assignment Jan 10, 2023
hediet added a commit that referenced this issue Jan 17, 2023
hediet added a commit that referenced this issue Jan 18, 2023
* Adresses #169806

* Fixes linter
sbatten added a commit that referenced this issue Jan 18, 2023
sbatten added a commit that referenced this issue Jan 18, 2023
@sbatten sbatten removed their assignment Jan 23, 2023
@hediet hediet removed their assignment Jan 26, 2023
@hediet hediet closed this as completed Jan 26, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Mar 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests