microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
160.51k stars 28.1k forks source link

Slow reponse to scroll and typing #107016

Open RLesma opened 3 years ago

RLesma commented 3 years ago

Issue Type: Performance Issue

It is not slow to start-up, it is slow to do anything in the text editor (scroll, find, type, etc). For example, when scrolling, the screen is unable to keep up with the mouse wheel and it will keep scrolling for a while after I stop the mouse wheel. I disabled the extensions I installed lately, and also reduced the amount of files in the workspace.

VS Code version: Code 1.49.1 (58bb7b2331731bf72587010e943852e13e6fd3cf, 2020-09-16T23:27:51.792Z) OS version: Windows_NT x64 10.0.19041

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz (4 x 2712)| |GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
protected_video_decode: enabled
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|11.85GB (4.20GB free)| |Process Argv|--crash-reporter-id 2c01e348-504e-456f-931c-280aa8926a03| |Screen Reader|no| |VM|0%|
Process Info ``` CPU % Mem MB PID Process 2 96 33588 code main 2 88 13340 shared-process 3 84 26656 window (Issue Reporter) 0 24 27836 crashpad-handler 0 223 30908 window (Settings - local_svn_workspace (Workspace) - Visual Studio Code) 0 11 6640 watcherService 0 6 12092 console-window-host (Windows internal process) 0 6 9240 console-window-host (Windows internal process) 0 96 19504 extensionHost 0 69 30740 C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe 0 60 30924 utility 1 241 33368 gpu-process ```
Workspace Info ``` | Window (Settings - local_svn_workspace (Workspace) - Visual Studio Code) | Folder (JESD204): 1760 files | File types: svn-base(998) v(161) sv(38) sh(33) tcl(30) prj(30) do(25) | tmp(9) txt(9) log(7) | Conf files: makefile(7); ```
Extensions (11) Extension|Author (truncated)|Version ---|---|--- better-comments|aar|2.1.0 bracket-pair-colorizer|Coe|1.0.61 ctags-support|jay|1.0.19 svn-scm|joh|2.12.4 rainbow-csv|mec|1.7.1 remote-ssh|ms-|0.55.0 remote-ssh-edit|ms-|0.55.0 remote-wsl|ms-|0.44.5 veriloghdl|msh|1.3.3 awesome-vhdl|puo|0.0.1 tcl|ras|0.1.0
vscodebot[bot] commented 3 years ago

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

alexdima commented 3 years ago

@RLesma Does this reproduce when disabling all extensions? Press F1 and then choose Developer: Reload Window with Extensions Disabled

Kapture 2020-07-20 at 15 28 23

jonas-jonas commented 3 years ago

I do have this issue now too. I don't think I had in any previous version. My observations:

Edit: My "about" information: Version: 1.49.0 (user setup) Commit: e790b931385d72cf5669fcefc51cdf65990efa5d Date: 2020-09-10T13:22:08.892Z Electron: 9.2.1 Chrome: 83.0.4103.122 Node.js: 12.14.1 V8: 8.3.110.13-electron.0 OS: Windows_NT x64 10.0.19041

Hope this helps!

EusthEnoptEron commented 3 years ago

I also noticed some lagginess when typing / scrolling on my end (1.49.1).

krenton commented 3 years ago

Experiencing the same problem. My about info:

Version: 1.49.1 (user setup)
Commit: 58bb7b2331731bf72587010e943852e13e6fd3cf
Date: 2020-09-16T23:27:51.792Z
Electron: 9.2.1
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Windows_NT x64 10.0.19041

Significant performance drop when editing files that have some sort of syntax highlighting. XML files were the worst; markdown was fine, but got worse when I added code snippets.

Recorded performance while typing/scrolling and saw a lot of warnings about "cumulative layout shift". Downgraded to version 1.48.2 - the problem is gone. Also no more "cumulative layout shift" warnings in performance recordings.

Edit: Actually checked: version 1.48.2 does have a small typing delay for me. Switching to 1.47.3 turned out to be the best experience.

RLesma commented 3 years ago

@RLesma Does this reproduce when disabling all extensions? Press F1 and then choose Developer: Reload Window with Extensions Disabled

Kapture 2020-07-20 at 15 28 23

I just did that, and it is still slow. Definitely not an extension issue.

RLesma commented 3 years ago

Downgrading to 1.48.2 also solved the issue for me.

alexdima commented 3 years ago

@deepak1556 Would you need more info here ? (this seems similar to #106456 , #106939 which are all on Windows)

deepak1556 commented 3 years ago

Thanks to the traces from @Minkyu-Choi and @Perh0rd , I was able to see a problematic area during the scroll operation.

Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::HasInheritedPresentationalRole
Code - Insiders.exe!blink::AXNodeObject::InheritsPresentationalRoleFrom
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::HasInheritedPresentationalRole
Code - Insiders.exe!blink::AXNodeObject::InheritsPresentationalRoleFrom
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::HasInheritedPresentationalRole
Code - Insiders.exe!blink::AXNodeObject::InheritsPresentationalRoleFrom
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::HasInheritedPresentationalRole
Code - Insiders.exe!blink::AXNodeObject::InheritsPresentationalRoleFrom
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::AccessibilityIsIgnored
Code - Insiders.exe!blink::AXObjectCacheImpl::FireAXEventImmediately
Code - Insiders.exe!blink::AXNodeObject::ChildrenChanged
Code - Insiders.exe!blink::AXObjectCacheImpl::ChildrenChanged
Code - Insiders.exe!blink::AXObjectCacheImpl::FireTreeUpdatedEventImmediately
Code - Insiders.exe!blink::AXObjectCacheImpl::ProcessUpdates
Code - Insiders.exe!blink::AXObjectCacheImpl::ProcessDeferredAccessibilityEvents
Code - Insiders.exe!blink::LocalFrameView::ForAllNonThrottledLocalFrameViews<`lambda at ../../third_party/blink/renderer/core/frame/local_frame_view.cc:2664:37'>
Code - Insiders.exe!blink::LocalFrameView::RunAccessibilityLifecyclePhase
Code - Insiders.exe!blink::LocalFrameView::UpdateLifecyclePhasesInternal
Code - Insiders.exe!blink::LocalFrameView::UpdateLifecyclePhases
Code - Insiders.exe!blink::PageAnimator::UpdateAllLifecyclePhases
Code - Insiders.exe!blink::WebViewImpl::UpdateLifecycle
Code - Insiders.exe!blink::WidgetBase::UpdateVisualState
Code - Insiders.exe!cc::LayerTreeHost::RequestMainFrameUpdate
Code - Insiders.exe!cc::ProxyMain::BeginMainFrame
Code - Insiders.exe!base::internal::Invoker<base::internal::BindState<void (cc::ProxyMain::*)(std::__1::unique_ptr<cc::BeginMainFrameAndCommitState,std::__1::default_delete<cc::BeginMainFrameAndCommitState>>),base::WeakPtr<cc::ProxyMain>,std::__1::unique_ptr<cc::BeginMainFrameAndCommitState,std::__1::default_delete<cc::BeginMainFrameAndCommitState>>>,void ()>::RunOnce
Code - Insiders.exe!base::TaskAnnotator::RunTask
Code - Insiders.exe!base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl
Code - Insiders.exe!base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork
Code - Insiders.exe!base::MessagePumpDefault::Run
Code - Insiders.exe!base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run
Code - Insiders.exe!base::RunLoop::Run
Code - Insiders.exe!content::RendererMain
Code - Insiders.exe!content::ContentMainRunnerImpl::Run
Code - Insiders.exe!service_manager::Main
Code - Insiders.exe!content::ContentMain
Code - Insiders.exe!wWinMain
Code - Insiders.exe!__scrt_common_main_seh
kernel32.dll!?
ntdll.dll!?
[Root]

I was not able to find the same stack in a trace from my local dev box, the AXObject is something that gets constructed for accessibility tree in the renderer, this gave a clue as to maybe the problem happens when accessibility is involved. Turning on the screen reader and performing the scroll did create the same stack along with a visible slowdown.

This brings me to my question, is everyone here seeing the issue had screen reader enabled ?

Minkyu-Choi commented 3 years ago

@deepak1556 Do you mean narrator enabled? Then, narrator is disabled. Also, I felt better scrolling when I used 1.48.2 version with same windows environment. Thank you for your work.

deepak1556 commented 3 years ago

Thanks for confirming, one more thing to try, can you launch with code-insiders --disable-features="LayoutNG" and check if the scroll is any better ?

Minkyu-Choi commented 3 years ago

Unfortunately, scroll behaved same with that option.

alexdima commented 3 years ago

@deepak1556 I have seen this in the past -- https://github.com/electron/electron/issues/7208 . Electron would enter accessibility mode on laptops with touch screens. IIRC the root problem was that on Windows there was no clear API to find out if a Screen Reader is attached, and the way to determine that was by checking some Windows events if they appeared to be similar to the ones that Screen Readers typically send. I'm not saying this is the same issue, but in that case there was also a lot of slowness experienced. So IMHO I think there are 2 issues here:

RLesma commented 3 years ago

Thanks to the traces from @Minkyu-Choi and @Perh0rd , I was able to see a problematic area during the scroll operation.

Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::HasInheritedPresentationalRole
Code - Insiders.exe!blink::AXNodeObject::InheritsPresentationalRoleFrom
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::HasInheritedPresentationalRole
Code - Insiders.exe!blink::AXNodeObject::InheritsPresentationalRoleFrom
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::HasInheritedPresentationalRole
Code - Insiders.exe!blink::AXNodeObject::InheritsPresentationalRoleFrom
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::HasInheritedPresentationalRole
Code - Insiders.exe!blink::AXNodeObject::InheritsPresentationalRoleFrom
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::BackgroundColor
Code - Insiders.exe!blink::AXLayoutObject::ComputeBackgroundColor
Code - Insiders.exe!blink::AXObject::UpdateCachedAttributeValuesIfNeeded
Code - Insiders.exe!blink::AXObject::AccessibilityIsIgnored
Code - Insiders.exe!blink::AXObjectCacheImpl::FireAXEventImmediately
Code - Insiders.exe!blink::AXNodeObject::ChildrenChanged
Code - Insiders.exe!blink::AXObjectCacheImpl::ChildrenChanged
Code - Insiders.exe!blink::AXObjectCacheImpl::FireTreeUpdatedEventImmediately
Code - Insiders.exe!blink::AXObjectCacheImpl::ProcessUpdates
Code - Insiders.exe!blink::AXObjectCacheImpl::ProcessDeferredAccessibilityEvents
Code - Insiders.exe!blink::LocalFrameView::ForAllNonThrottledLocalFrameViews<`lambda at ../../third_party/blink/renderer/core/frame/local_frame_view.cc:2664:37'>
Code - Insiders.exe!blink::LocalFrameView::RunAccessibilityLifecyclePhase
Code - Insiders.exe!blink::LocalFrameView::UpdateLifecyclePhasesInternal
Code - Insiders.exe!blink::LocalFrameView::UpdateLifecyclePhases
Code - Insiders.exe!blink::PageAnimator::UpdateAllLifecyclePhases
Code - Insiders.exe!blink::WebViewImpl::UpdateLifecycle
Code - Insiders.exe!blink::WidgetBase::UpdateVisualState
Code - Insiders.exe!cc::LayerTreeHost::RequestMainFrameUpdate
Code - Insiders.exe!cc::ProxyMain::BeginMainFrame
Code - Insiders.exe!base::internal::Invoker<base::internal::BindState<void (cc::ProxyMain::*)(std::__1::unique_ptr<cc::BeginMainFrameAndCommitState,std::__1::default_delete<cc::BeginMainFrameAndCommitState>>),base::WeakPtr<cc::ProxyMain>,std::__1::unique_ptr<cc::BeginMainFrameAndCommitState,std::__1::default_delete<cc::BeginMainFrameAndCommitState>>>,void ()>::RunOnce
Code - Insiders.exe!base::TaskAnnotator::RunTask
Code - Insiders.exe!base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl
Code - Insiders.exe!base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork
Code - Insiders.exe!base::MessagePumpDefault::Run
Code - Insiders.exe!base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run
Code - Insiders.exe!base::RunLoop::Run
Code - Insiders.exe!content::RendererMain
Code - Insiders.exe!content::ContentMainRunnerImpl::Run
Code - Insiders.exe!service_manager::Main
Code - Insiders.exe!content::ContentMain
Code - Insiders.exe!wWinMain
Code - Insiders.exe!__scrt_common_main_seh
kernel32.dll!?
ntdll.dll!?
[Root]

I was not able to find the same stack in a trace from my local dev box, the AXObject is something that gets constructed for accessibility tree in the renderer, this gave a clue as to maybe the problem happens when accessibility is involved. Turning on the screen reader and performing the scroll did create the same stack along with a visible slowdown.

This brings me to my question, is everyone here seeing the issue had screen reader enabled ?

I do not use the screen reader

RLesma commented 3 years ago

image

This shows that the narrator is not enabled, I think

Perh0rd commented 3 years ago

Just to add, I do not have a touchscreen neither

deepak1556 commented 3 years ago

Thanks @alexdima for the additional context,

I also remember that Electron had some custom code here on top of Chromium so maybe that one no longer works correctly?

https://github.com/electron/electron/blob/master/shell/browser/native_window_views_win.cc#L196-L225

Considering users facing the issue don't have narrator enabled, definitely a bug in either electron/chromium entering accessible mode by default.

why is Chromium so slow when it enables accessibility mode -- that should not be the case

Don't have a definitive answer for this, workaround given by chromium authors to prevent this particular stack was to add a non-transparent background color. We might want to check on this perf issue with newer versions of chromium. I am currently building a exploration release based on Chromium 87.

deepak1556 commented 3 years ago

Here is exploration build based on chromium 87 https://az764295.vo.msecnd.net/exploration/53c0ab95bb770a8f3f869e81bb9da200708e6700/VSCodeUserSetup-x64-1.50.0-exploration.exe , can you check if the slowdown is still visible. Thanks!

One more question to users facing the issue, are you running windows on some VM ?

deepak1556 commented 3 years ago

Apart from testing the exploration builds, can you also check if launching code --disable-renderer-accessibility fixes the issue.

Minkyu-Choi commented 3 years ago

@deepak1556 code-insider with --disable-rendere-accessibility options shows much better scrolls both keyboard and wheel than before! Also, exploration build scrolls better than before but not better than disable-renderer-accessibility option. Finally, I'm not running windows on VM. It seems like disable-renderer-accessibility option is best workaround now.

deepak1556 commented 3 years ago

Perfect, thanks. Couple more testing to narrow down the issue,

> const { app } = require('electron')
> app.isAccessibilitySupportEnabled()
Minkyu-Choi commented 3 years ago

electron.exe -i gives 'Electron REPL not currently supported on Windows' and I couldn't get interactive session. How can I deal with this?

deepak1556 commented 3 years ago

Oops, sorry didn't notice it. Try this instead, add the following contents to some test.js file

const {app, BrowserWindow } = require('electron')

app.on('accessibility-support-changed', (ev, accessibilitySupportEnabled) => {
  console.log(`Accesibility support changed : ${accessibilitySupportEnabled}`)
})

function createWindow () {
  const mainWindow = new BrowserWindow({
    width: 800,
    height: 600
  })

  mainWindow.webContents.on('did-finish-load', () => {
    console.log(`Accessibility support onLoad : ${app.isAccessibilitySupportEnabled()}`)
  })

  mainWindow.loadURL('https://vscode-web-test-playground.azurewebsites.net/?enter=true')
}

app.on('ready', createWindow)

app.on('window-all-closed', function () {
    app.quit()
})

then

electron.exe <path>/test.js --enable-logging

open some files, do some scroll and attach the terminal log.

Minkyu-Choi commented 3 years ago

I've seen slow scroll performance.

Here's terminal log

Accessibility support onLoad : false
[27748:0924/132800.617:INFO:CONSOLE(14)] "(electron) Security Warning: webFrame.executeJavaScript was called without worldSafeExecuteJavaScript enabled. This is considered unsafe. worldSafeExecuteJavaScript will be enabled by default in Electron 12.", source: electron/js2c/renderer_init.js (14)
[27748:0924/132800.617:INFO:CONSOLE(134)] "%cElectron Security Warning (enableRemoteModule) font-weight: bold; This renderer process has "enableRemoteModule" enabled
    and attempted to load remote content from 'https://vscode-web-test-playground.azurewebsites.net/?enter=true'. This
    exposes users of this app to unnecessary security risks.

For more information and help, consult
https://electronjs.org/docs/tutorial/security.
This warning will not show up
once the app is packaged.", source: electron/js2c/renderer_init.js (134)
[27748:0924/132800.618:INFO:CONSOLE(134)] "%cElectron Security Warning (Insecure Content-Security-Policy) font-weight: bold; This renderer process has either no Content Security
    Policy set or a policy with "unsafe-eval" enabled. This exposes users of
    this app to unnecessary security risks.

For more information and help, consult
https://electronjs.org/docs/tutorial/security.
This warning will not show up
once the app is packaged.", source: electron/js2c/renderer_init.js (134)
[27748:0924/132800.677:INFO:CONSOLE(1656)] "%c WARN color: #993 Ignoring the error while validating workspace folder memfs:/sample-folder - No file system provider found for resource 'memfs:/sample-folder'", source: https://vscode-web-test-playground.azurewebsites.net/static-insider-f943318042a3b9229049aea86cea04d0ff9c8210/out/vs/workbench/workbench.web.api.js (1656)
[27748:0924/132800.784:INFO:CONSOLE(3049)] "Unable to instantiate workbench contribution oe. TypeError: Cannot read property 'options' of undefined", source: https://vscode-web-test-playground.azurewebsites.net/static-insider-f943318042a3b9229049aea86cea04d0ff9c8210/out/vs/workbench/workbench.web.api.js (3049)
[27748:0924/132800.785:INFO:CONSOLE(3049)] "Unable to instantiate workbench contribution p. TypeError: Cannot read property 'options' of undefined", source: https://vscode-web-test-playground.azurewebsites.net/static-insider-f943318042a3b9229049aea86cea04d0ff9c8210/out/vs/workbench/workbench.web.api.js (3049)
[27748:0924/132800.856:INFO:CONSOLE(1656)] "%c  ERR color: #f33 Cannot read property 'options' of undefined: TypeError: Cannot read property 'options' of undefined
    at n.isEnabled (https://vscode-web-test-playground.azurewebsites.net/static-insider-f943318042a3b9229049aea86cea04d0ff9c8210/out/vs/workbench/workbench.web.api.js:5953:614)
    at new _ (https://vscode-web-test-playground.azurewebsites.net/static-insider-f943318042a3b9229049aea86cea04d0ff9c8210/out/vs/workbench/workbench.web.api.js:2896:792)
    at new n (https://vscode-web-test-playground.azurewebsites.net/static-insider-f943318042a3b9229049aea86cea04d0ff9c8210/out/vs/workbench/workbench.web.api.js:5953:398)
    at d._createInstance (https://vscode-web-test-playground.azurewebsites.net/static-insider-f943318042a3b9229049aea86cea04d0ff9c8210/out/vs/workbench/workbench.web.api.js:1640:446)
    at https://vscode-web-test-playground.azurewebsites.net/static-insider-f943318042a3b9229049aea86cea04d0ff9c8210/out/vs/workbench/workbench.web.api.js:1642:233
    at t.IdleValue._executor (https://vscode-web-test-playground.azurewebsites.net/static-insider-f943318042a3b9229049aea86cea04d0ff9c8210/out/vs/workbench/workbench.web.api.js:136:349)
    at t.IdleValue.get value [as value] (https://vscode-web-test-playground.azurewebsites.net/static-insider-f943318042a3b9229049aea86cea04d0ff9c8210/out/vs/workbench/workbench.web.api.js:136:542)
    at Object.get (https://vscode-web-test-playground.azurewebsites.net/static-insider-f943318042a3b9229049aea86cea04d0ff9c8210/out/vs/workbench/workbench.web.api.js:1642:334)
    at new e (https://vscode-web-test-playground.azurewebsites.net/static-insider-f943318042a3b9229049aea86cea04d0ff9c8210/out/vs/workbench/workbench.web.api.js:5996:748)
    at d._createInstance (https://vscode-web-test-playground.azurewebsites.net/static-insider-f943318042a3b9229049aea86cea04d0ff9c8210/out/vs/workbench/workbench.web.api.js:1640:446)", source: https://vscode-web-test-playground.azurewebsites.net/static-insider-f943318042a3b9229049aea86cea04d0ff9c8210/out/vs/workbench/workbench.web.api.js (1656)
[27748:0924/132826.216:INFO:CONSOLE(1656)] "%c INFO color: #33f [lifecycle] onBeforeUnload triggered", source: https://vscode-web-test-playground.azurewebsites.net/static-insider-f943318042a3b9229049aea86cea04d0ff9c8210/out/vs/workbench/workbench.web.api.js (1656)
deepak1556 commented 3 years ago

If you have visual studio x64 Native Tools Command Prompt , can you run the following


// cl.exe source.cpp -o screen_reader_checker.exe /EHsc

#include <windows.h>
#include <uiautomation.h>
#include <iostream>

#pragma comment(lib,"user32.lib")
#pragma comment(lib,"Uiautomationcore.lib") 

int main()
{
  UINT screenReader = 0;
  SystemParametersInfo(SPI_GETSCREENREADER, 0, &screenReader, 0);
  std::cerr << screenReader && UiaClientsAreListening();
}

If not, I can provide the compiled version, main idea is to confirm if electron is entering accessible mode by default on your system.

Minkyu-Choi commented 3 years ago

I don't have. Can you provide compiled version?

deepak1556 commented 3 years ago

screen_reader_checker.zip

Minkyu-Choi commented 3 years ago

Output is number zero like following

PS C:\> .\screen_reader_checker.exe
0
deepak1556 commented 3 years ago

hmm, that definitely doesn't align with other findings so far. Let me tweak the electron example a bit.

Thanks for all the testing so far, it has been really helpful. Would be great if you can run this test too.

Minkyu-Choi commented 3 years ago

You already solved my issue with great workaround. I'll trying to help you whenever I can. Anyway I think so. It's very weird. However, window.isAccessible() outputs false like following.

Capture 2020-09-24 153944

deepak1556 commented 3 years ago

@alexdima from the above tests, looks like electron's custom code isn't forcing the accessible mode in this case.

we might want to look into adding Electron API such that we can disable it entirely and offer a flag or option for people experiencing problems with this to disable it completely

--disable-renderer-accessibility would be the flag.

@Minkyu-Choi when possible can you share another wpr trace for the exploration build https://github.com/microsoft/vscode/issues/107016#issuecomment-697727159

deepak1556 commented 3 years ago

Others who have reported this issue, please confirm the following

Perh0rd commented 3 years ago

Here is exploration build based on chromium 87 https://az764295.vo.msecnd.net/exploration/53c0ab95bb770a8f3f869e81bb9da200708e6700/VSCodeUserSetup-x64-1.50.0-exploration.exe , can you check if the slowdown is still visible. Thanks!

One more question to users facing the issue, are you running windows on some VM ?

Yes we are running our environnement in Azure WVD

Perh0rd commented 3 years ago

Here is exploration build based on chromium 87 https://az764295.vo.msecnd.net/exploration/53c0ab95bb770a8f3f869e81bb9da200708e6700/VSCodeUserSetup-x64-1.50.0-exploration.exe , can you check if the slowdown is still visible. Thanks! One more question to users facing the issue, are you running windows on some VM ?

Yes we are running our environnement in Azure WVD

@deepak1556 To answer your question :

RLesma commented 3 years ago

Others who have reported this issue, please confirm the following

* Does running with `--disable-renderer-accessibility` help improve the perf ?

* What is the output of running [#107016 (comment)](https://github.com/microsoft/vscode/issues/107016#issuecomment-698132350)

* Is the exploration build [#107016 (comment)](https://github.com/microsoft/vscode/issues/107016#issuecomment-697727159) any better in perf ?

For me running it like this from the powershell did not help, still the same laginess: code --disable-renderer-accessibility

RLesma commented 3 years ago

The output of the screen reader checker is 0

alexdima commented 3 years ago

@RLesma just to double check: sometimes, if there is a vscode instance running, running code on the command line will not start a new instance of vscode, it will just talk to the running instance and ask it to open a new window. So the test would be to be sure (via Task Manager if necessary) that no code instances are running when you are trying out the command line flag.

RLesma commented 3 years ago

Here is exploration build based on chromium 87 https://az764295.vo.msecnd.net/exploration/53c0ab95bb770a8f3f869e81bb9da200708e6700/VSCodeUserSetup-x64-1.50.0-exploration.exe , can you check if the slowdown is still visible. Thanks!

One more question to users facing the issue, are you running windows on some VM ?

I am not running windows on a VM

RLesma commented 3 years ago

@RLesma just to double check: sometimes, if there is a vscode instance running, running code on the command line will not start a new instance of vscode, it will just talk to the running instance and ask it to open a new window. So the test would be to be sure (via Task Manager if necessary) that no code instances are running when you are trying out the command line flag.

Oh, you were completely right! closing all the instances and then starting it up with the --disable-renderer-accessibility flag solved the issue! The performance improved dramatically! Thank you for the tip! I thought that the new instance would have the flag set, even if I had other instances open.

Is there any way to set this flag by default in a link? I have to investigate this, not to have to open the shell all the time

deepak1556 commented 3 years ago

Is there any way to set this flag by default in a link?

RLesma commented 3 years ago

Awesome! Thank you. I hope that you can fix the issue in the next release, but for now I am happy 👍 Have a good day!

racedaemon commented 3 years ago

--disable-renderer-accessibility also solves the problem for me.

The strange thing is that the problem is intermitent. I'm starting to believe it has something to do with running the Spotify or YouTube Music apps. Spotify is probably built with Electron but YouTube Music appears to be a simple PWA.

Previously I was able to resolve the problem without restarting the PC by closing some recently started processes. It usually was something to do with the Windows Store app. The problem is that it worked two or three times and then this fix stopped working.

Maybe it has something to do with a platform wide accessibility integration. Or maybe it is just intermitent and I start seeing patterns where there aren't any.

Running on a 4770K with 16GB of RAM on a SSD. Maybe the older CPU also make the problem evident in smaller files. When scrolling a 336 line .js file the main thread of the code.exe process affected by scrolling shows a maximum CPU load of 7% without the problem and as high as 25% with.

I use Fira Code as a font, if that somehow matters.

These are the command line parameters on the process with CPU differences after I have added --disable-renderer-accessibilit:

"C:\Users\SomeUser\AppData\Local\Programs\Microsoft VS Code\Code.exe" --type=renderer --disable-color-correct-rendering --field-trial-handle=1064,1665750072167642108,6849531731066259693,131072 --enable-features=WebComponentsV0Enabled --disable-features=SpareRendererForSitePerProcess --lang=en-US --standard-schemes=vscode-webview,vscode-webview-resource --secure-schemes=vscode-webview,vscode-webview-resource --bypasscsp-schemes --cors-schemes=vscode-webview,vscode-webview-resource --fetch-schemes=vscode-webview,vscode-webview-resource --service-worker-schemes --app-user-model-id=Microsoft.VisualStudioCode --app-path="C:\Users\SomeUser\AppData\Local\Programs\Microsoft VS Code\resources\app" --node-integration --webview-tag --no-sandbox --no-zygote --native-window-open --preload="c:\Users\SomeUser\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\base\parts\sandbox\electron-browser\preload.js" --background-color=#000000 --device-scale-factor=1 --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=5 --no-v8-untrusted-code-mitigations --mojo-platform-channel-handle=2584 /prefetch:1

Data obtained with Process Explorer.

jake-walker commented 3 years ago

I was also having lag when scrolling and typing and the integrated terminal was very slow to print out lines and using --disable-renderer-accessibility has fixed the issue for me.

thien-do commented 3 years ago

This also happens on Linux

Others who have reported this issue, please confirm the following

* Does running with `--disable-renderer-accessibility` help improve the perf ?

Yes

* What is the output of running [#107016 (comment)](https://github.com/microsoft/vscode/issues/107016#issuecomment-698132350) 
* Is the exploration build [#107016 (comment)](https://github.com/microsoft/vscode/issues/107016#issuecomment-697727159) any better in perf ?

I'm using a Linux so I can't test it :(

bkromhout commented 3 years ago

This started happening to me as well since either 1.50.0 or 1.50.1 (I think it was the latter, but can't quite remember), and I can confirm that adding --disable-renderer-accessibility has also mitigated the issue for me as well.

Is there any more-permanent fix being investigated for this?

YellowAfterlife commented 3 years ago

Others who have reported this issue, please confirm the following

  • Does running with --disable-renderer-accessibility help improve the perf ?
  • What is the output of running #107016 (comment)
  • Is the exploration build #107016 (comment) any better in perf ?

This is great news - in my case free-scrolling on MX Master 3 (which rapidly emits mouse wheel events) was bringing VSC to a grinding halt (with 3-4FPS at peak scroll speed);
I have asked someone that uses the same mouse model, they confirmed that it was an issue for them as well, but said that they did not feel motivated enough to investigate this since they primarily relied on Outline View for navigation (have now pointed them towards your comment);
My attempts of profiling VSC had proven unsuccessful as the most I could see is that massive amounts of time were being used on non-JS code.

As a bonus, --disable-renderer-accessibility seemed to have helped with mystery lag in another Chromium-based application. Is this a matter of calling app.setAccessibilitySupportEnabled(false) when necessary?

deepak1556 commented 3 years ago

Thanks for the additional data. --disable-renderer-accessibility is just a temporary workaround, the problem is that some markup structure is causing the accessibility tree to recurse more than it should. I haven't gotten to debugging this further and creating a minimal repro which would be the next step.

jameshelou commented 3 years ago

Hi all - just want to confirm on Windows 10 (v1809) that running vscode with --disable-renderer-accessibility has dramatically increased scroll performance for me especially on larger files.

pushkine commented 3 years ago

An easy way to reproduce this issue on windows 10 is to open the built-in windows on-screen keyboard

DKhalil commented 3 years ago

Same issue here and it got fixed with --disable-renderer-accessibility as well here, on Win10 (v2004), on vscode 1.50.1