Significant slowdown when evaluating re.sub(...) functions in versions after 2021.9.1 #1979
Labels
fixed in next version (main)
A fix has been implemented and will appear in an upcoming version
Environment data
Expected behavior
Pylance provides close to real time syntax coloring.
Actual behavior
Pylance takes 22 seconds to provide syntax coloring for a simple script and up to 391 seconds for a more complicated script, during which time syntax coloring is not available to other scripts. Slowdown seems to involve regular expression substitution.
Example Setup
.vscode/settings.json
functional_script.py
super_slow_script.py
Logs
Logs were generated by reloading VSCode while viewing the script in question.
functional_script.py, Any Language Server Version
super_slow_script.py, Language Server Version <= 2021.9.1, Functioning Normally
super_slow_script.py, Language Server Version >= 2021.9.2, NOT Functioning Normally
Key line:
Additional Notes
text = re.sub(r'include\s+' + file, new_text[0], text)
text = re.sub(r'include_once\s+'+file, new_text[0], text)
"python.analysis.logLevel": "Trace"
does not significantly affect speedsget_text_in_file(...)
reduces time to 7295msCurrent Work Around
Revert to Version 2021.9.1, no serious impact on productivity
The text was updated successfully, but these errors were encountered: