Closed egonelbre closed 4 years ago
https://github.com/microsoft/vscode/issues/82549 could end up fixing this as a side-effect.
Profiling seems to indicate that the parsing time is growing non-linearly, which isn't great.
size | time |
---|---|
~5K | ~2.5s |
~10K | ~9s |
~15K | ~20s |
~19K | ~34s |
The main culprit seems to be "match": "(?<!var)\\s*(\\w+(?:\\.\\w+)*(?>,\\s*\\w+(?:\\.\\w+)*)*)(?=\\s*=(?!=))",
at https://github.com/microsoft/vscode/blob/master/extensions/go/syntaxes/go.tmLanguage.json#L231
Removal improvement: 15.1s -> 3.6s.
The second culprit is "match": "(\\bfunc\\b)|(\\w+)(?=\\()",
at https://github.com/microsoft/vscode/blob/master/extensions/go/syntaxes/go.tmLanguage.json#L130
Changing to \\bfunc\\b
improved from 3.6s -> 0.006s.
I also tried opening the same file with Atom so it doesn't seem like a problem in https://github.com/atom/language-go.
PS: I'm aware the changes aren't correct, but they demonstrate the performance issue.
Thank you for the detail investigation!
Atom doesn't use the textmate grammar at https://github.com/atom/language-go anymore, so issues with the textmate grammar that VS Code uses likely won't occur there.
Since atom is no longer making changes to the textmate grammar, #82549 is the best hope for fixing this.
Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues here. See also our issue reporting guidelines.
Happy Coding!
Issue Type: Performance Issue
File https://gist.githubusercontent.com/egonelbre/f93be4d31e7f4dad766a5e8f63374bb3/raw/747cf854bef769e3b8f57edbe207e4e001d98421/example.go is very slow to open. ~20s
This does not happen when file is renamed to example.c.
VS Code version: Code 1.40.2 (f359dd69833dd8800b54d458f6d37ab7c78df520, 2019-11-25T14:52:45.129Z) OS version: Darwin x64 19.2.0
System Info
|Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz (4 x 2700)| |GPU Status|2d_canvas: enabledflash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|3, 4, 3| |Memory (System)|8.00GB (0.10GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
Workspace Info
``` | Window (~/code/adventofcode >) | Folder (adventofcode): 63 files | File types: go(43) gitignore(1) mod(1) js(1) json(1) md(1) | Conf files: settings.json(1); ```Extensions (6)
Extension|Author (truncated)|Version ---|---|--- gotemplate|cas|0.3.0 dart-code|Dar|3.7.0 vue|jcb|0.1.5 csharp|ms-|1.21.8 proto|pet|0.0.2 vscode-svg-previewer|vit|0.5.1Profiling seems to indicate Go syntax highlighting is hitting a bad-case.