yzhang-gh / vscode-markdown

Markdown All in One
https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one
MIT License
2.84k stars 322 forks source link

Slowness in typing #1441

Open anujchan opened 2 weeks ago

anujchan commented 2 weeks ago

Type: Bug

The extension whewn enabled is leading to lag in typing.

Extension version: 3.6.2 VS Code version: Code 1.89.1 (Universal) (dc96b837cf6bb4af9cd736aa3af08cf8279f7685, 2024-05-07T05:14:24.611Z) OS version: Darwin x64 23.3.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz (8 x 2300)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|6, 4, 3| |Memory (System)|32.00GB (1.90GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
FreeMasen commented 1 week ago

I suspect that the issue might be here, at least from my experience this is the worst when interacting with lists and most noticeable when attempting to backspace.

One thing that could be an issue is that regular expressions may be getting re-compiled on every use hoisting those into const declarations may help.

Another thing that could be helpful is adding a short debounce timer here to avoid re-calculation until the series of operations has completed, maybe something like a 300ms or lower threshold or lower, this will increase responsiveness for users hammering the backspace key, though care will need to be taken to coordinate with the insert path

yzhang-gh commented 5 days ago

Sorry for the late reply. I would suggest first checking this https://github.com/yzhang-gh/vscode-markdown?tab=readme-ov-file#q-the-extension-is-unresponsive-causing-lag-etc-performance-issues

There are some related threads that may also be helpful (e.g. #423)