DavidAnson / vscode-markdownlint

Markdown linting and style checking for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint
MIT License
897 stars 166 forks source link

Huge performance impact introducing big lag input #286

Closed T3sT3ro closed 1 year ago

T3sT3ro commented 1 year ago

Type: Performance Issue

On a file that has around 1500 lines (if wrapped lines were split into new, then it would be ~3000 lines long) enabling the markdownlint extension introduces huge input lags. It is difficult to type anything. Sometimes I wait for several seconds for actions to take place. For example it's very hard to type when creating links: I type "[]", left arrow, paste text, right arrow, type "()", left arrow, paste link. The input can get pretty messed up with characters appearing in wrong places and caret ending up in a completely another dimension.

Extension version: 0.50.0 VS Code version: Code 1.78.2 (b3e4e68a0bc097f0ae7907b217c1119af9e03435, 2023-05-10T14:47:05.613Z) OS version: Linux x64 6.0.0-1007-oem Modes: Sandboxed: Yes

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz (12 x 2200)| |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
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|3, 2, 2| |Memory (System)|19.41GB (7.87GB free)| |Process Argv|--unity-launch --crash-reporter-id 134570e7-1a1d-479b-a63b-30f0e98adab2| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|ubuntu| |XDG_CURRENT_DESKTOP|Unity| |XDG_SESSION_DESKTOP|ubuntu| |XDG_SESSION_TYPE|x11|
Process Info ``` CPU % Mem MB PID Process 0 159 64720 code main 0 40 64724 zygote 0 139 64755 gpu-process 0 40 64725 zygote 0 0 64727 zygote 0 318 64805 window [1] (Running Extensions - notes - Visual Studio Code) 0 80 90216 window [2] (Issue Reporter) 0 60 64777 utility-network-service 0 99 64919 shared-process 0 60 64954 ptyHost 0 0 90244 /bin/sh -c /usr/bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command= 0 0 90245 /usr/bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command= 0 477 80265 extensionHost [1] 0 60 80297 electron-nodejs (/usr/share/code/code --ms-enable-electron-run-as-node /usr/share/code/resources/app/extensions/markdown-language-features/server/dist/node/workerMain --node-ipc --clientProcessId=80265) 0 119 80517 electron-nodejs (/usr/share/code/code --ms-enable-electron-run-as-node /home/tooster/.vscode/extensions/vue.volar-1.6.4/server.js --node-ipc --clientProcessId=80265) 0 80 80530 electron-nodejs (/usr/share/code/code --ms-enable-electron-run-as-node /home/tooster/.vscode/extensions/vue.volar-1.6.4/server.js --node-ipc --clientProcessId=80265) 0 60 80566 electron-nodejs (/usr/share/code/code --ms-enable-electron-run-as-node /home/tooster/.vscode/extensions/dbaeumer.vscode-eslint-2.4.0/server/out/eslintServer.js --node-ipc --clientProcessId=80265) 0 80 80567 electron-nodejs (/usr/share/code/code --ms-enable-electron-run-as-node /usr/share/code/resources/app/extensions/html-language-features/server/dist/node/htmlServerMain --node-ipc --clientProcessId=80265) 0 358 80574 electron-nodejs (/usr/share/code/code --ms-enable-electron-run-as-node /home/tooster/.vscode/extensions/streetsidesoftware.code-spell-checker-2.20.4/packages/_server/dist/main.js --node-ipc --clientProcessId=80265) 0 60 80281 fileWatcher [1] ```
Workspace Info ``` | Window (Running Extensions - notes - Visual Studio Code) | Folder (notes): 210 files | File types: pdf(90) md(42) png(21) edn(3) jpg(3) json(2) html(2) | gitignore(1) webp(1) css(1) | Conf files: launch.json(1) settings.json(1) dockerfile(1) | Launch Configs: chrome; ```
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 vserr242:30382549 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vsdfh931:30280409 vshan820:30294714 vstes263:30335439 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593:30376534 pythonvs932:30410667 cppdebug:30492333 vsclangdf:30486550 c4g48928:30535728 dsvsc012cf:30540253 pynewext54:30695312 azure-dev_surveyone:30548225 282f8724:30602487 pyind779:30671433 f6dab269:30613381 pythonsymbol12:30671437 showlangstatbar:30737416 vsctsb:30748421 pythonms35:30701012 ecj1e332:30736112 pythonfmttext:30731395 fixshowwlkth:30730052 showsbindicator:30730056 pythongtdpathcf:30739705 ```
CPU profile [yzhang.markdown-all-in-one-unresponsive.cpuprofile.txt](https://github.com/DavidAnson/vscode-markdownlint/files/11554413/yzhang.markdown-all-in-one-unresponsive.cpuprofile.txt)
DavidAnson commented 1 year ago

Sorry about that! It's very likely to be due to some pretty bad edge case behavior in the micromark parser. This should be much improved in the next release. More info here: https://github.com/DavidAnson/markdownlint/issues/821

DavidAnson commented 1 year ago

VS Code allows you to install older extension versions and you might want to go back one version if this is common for files you deal with. The delay is probably most severe with tables, but I don't think that's necessary to see a slow down.