artisticat1 / obsidian-latex-suite

Make typesetting LaTeX as fast as handwriting through snippets, text expansion, and editor enhancements
MIT License
1.43k stars 56 forks source link

Improve performance of `runSnippetCursor` #323

Closed shunby closed 3 months ago

shunby commented 3 months ago

Optimizes runSnippetCursor in run_snippet.ts by reducing redundant calls to view.state.sliceDoc. Partially solves #320 by improving the editting of large files.

Performance Testing

Tested with a large markdown file generated with the following command:

python -c "print('aa\n'*4000)" > test.md

Pushed a key when the cursor is at the bottom of the file and measured the time spent handling the keydown event using DevTools.

Test Environment:

Results:

artisticat1 commented 3 months ago

Thanks!

CamWam commented 3 months ago

Thank you!!!!