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

QuickAccess on Remote Development is slow #157056

Closed
wzhudev opened this issue Aug 4, 2022 · 6 comments
Closed

QuickAccess on Remote Development is slow #157056

wzhudev opened this issue Aug 4, 2022 · 6 comments
Assignees

Comments

@wzhudev
Copy link
Contributor

wzhudev commented Aug 4, 2022

Issue Type: Bug

I don't now how to reproduce it on other machines. On my occasion I am running vscode remote on a Linux (Debian) machine. So I am going to upload a profile here and see if it helps.

截屏2022-08-04 10 06 28

截屏2022-08-04 10 13 23

It seems that it is related to findFormatting.

VS Code version: Code 1.69.2 (3b889b0, 2022-07-18T16:12:57.074Z)
OS version: Darwin x64 21.6.0
Restricted Mode: No
Remote OS version: Linux x64 5.4.56.bsk.10-amd64

System Info
Item Value
CPUs Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 2, 2, 2
Memory (System) 32.00GB (5.18GB free)
Process Argv --crash-reporter-id 6f7fef97-bf68-4304-98b4-8812ae5d3ad3
Screen Reader no
VM 0%
Item Value
Remote SSH: devcloud
OS Linux x64 5.4.56.bsk.10-amd64
CPUs Intel(R) Xeon(R) Platinum 8260 CPU @ 2.40GHz (8 x 2394)
Memory (System) 15.01GB (8.55GB free)
VM 0%
Extensions (18)
Extension Author (truncated) Version
Bookmarks ale 13.3.1
remote-ssh ms- 0.85.2022071315
remote-ssh-edit ms- 0.80.0
svg-preview Sim 2.8.3
vscode-icons vsc 11.14.0
vim vsc 1.23.2
Bookmarks ale 13.3.1
vscode-eslint dba 2.2.6
gitlens eam 12.1.2
EditorConfig Edi 0.16.6
prettier-vscode esb 9.5.0
todo-tree Gru 0.0.215
git-graph mhu 1.30.0
svg-preview Sim 2.8.3
code-spell-checker str 2.3.4
tldraw-vscode tld 1.19.0
vscode-icons vsc 11.14.0
vitest-explorer Zix 0.2.23

(1 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonvspyt551:30345470
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscorecescf:30445987
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
vscscmwlcmt:30465135
cppdebug:30492333
pylanb8912cf:30529770
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253

@wzhudev
Copy link
Contributor Author

wzhudev commented Aug 4, 2022

@TylerLeonhardt
Copy link
Member

Can you describe what you're doing when you see this slowness?

@wzhudev
Copy link
Contributor Author

wzhudev commented Aug 6, 2022

截屏2022-08-06 10 28 17

截屏2022-08-06 10 30 37

I digged a little bit and foud out there are thousands of formatters. And there are loaded from local storage. And everytime I reload the window, it increases.

截屏2022-08-06 10 37 48

@TylerLeonhardt

@wzhudev
Copy link
Contributor Author

wzhudev commented Aug 6, 2022

Can you describe what you're doing when you see this slowness?

I was using cmd + p to search files. This is how findFormatting get called:

截屏2022-08-06 11 22 58

@wzhudev
Copy link
Contributor Author

wzhudev commented Aug 6, 2022

registerCachedFormatter(formatter: ResourceLabelFormatter): IDisposable {
const list = this.storedFormatters.formatters ??= [];
let replace = list.findIndex(f => f.scheme === formatter.scheme && f.authority === formatter.authority);
if (replace === -1 && list.length >= FORMATTER_CACHE_SIZE) {
replace = FORMATTER_CACHE_SIZE - 1; // at max capacity, replace the last element
}
if (replace === -1) {
list.unshift(formatter);
} else {
for (let i = replace; i > 0; i--) {
list[i] = list[i - 1];
}
list[0] = formatter;
}
this.storedFormattersMemento.saveMemento();
return this.registerFormatter(formatter);
}
registerFormatter(formatter: ResourceLabelFormatter): IDisposable {
this.formatters.push(formatter);
this._onDidChangeFormatters.fire({ scheme: formatter.scheme });
return {
dispose: () => {
this.formatters = this.formatters.filter(f => f !== formatter);
this._onDidChangeFormatters.fire({ scheme: formatter.scheme });
}
};
}

Before registerCachedFormatter is called, registerFormatter gets called serveral times and pushes formatters into this.formatters. Since this.storedFormatters and this.formatters point to the same array:

this.storedFormatters = memento.getMemento(StorageScope.PROFILE, StorageTarget.MACHINE);
this.formatters = this.storedFormatters?.formatters?.slice() || [];

These newly registered formatters get stored as well.

@wzhudev
Copy link
Contributor Author

wzhudev commented Aug 6, 2022

Oh I see it's already fixed #157313 (.slice() wasn't there when I came across the issue). Closing this now.

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

No branches or pull requests

5 participants