vim-pandoc-syntax icon indicating copy to clipboard operation
vim-pandoc-syntax copied to clipboard

Slow syntax highlighting profile

Open rafaqz opened this issue 10 years ago • 4 comments

I've just been profiling pandoc syntax as it seemed much slower than other highlighters when swapping buffers (I know: it still only takes a quarter of a second! but usually its virtually instant)

It seems the cause is running the html, javascript, css, vb, tex and yaml syntax highlighter every time, (especially html and css) wether there is code in the page or not. Is there a way of limiting this manually? eg. to just yaml and tex? It wasn't affected by:

let g:pandoc#syntax#codeblocks#embeds#langs = []

rafaqz avatar Mar 13 '16 04:03 rafaqz

Normally it should only include html, yaml and tex, what you describe seems weird.

fmoralesc avatar Mar 13 '16 14:03 fmoralesc

Still, you have to reload the syntax (syntax on) for that variable to catch on, so perhaps try that.

What made the pandoc highlighting slow in my tests were the table-related highlighting, the regexes are way complicated and take some time. I was thinking of making the syntax highlighting for this layered, so those could be loaded only on demand.

fmoralesc avatar Mar 13 '16 14:03 fmoralesc

I'm not sure why the vb, javascript and css was there - It could be from another plugin, but it didn't run when I removed pandoc-sytax, so they would have to be brought in in some complex codependent way. I will look into it again when I have time and give you a bit more to go on.

Also my test pages had no tables, but if those regexes just runs anyway then yeah that would be an overhead.

rafaqz avatar Mar 15 '16 06:03 rafaqz

I've been trying to track down why this highlighter is adding ~5 second delays to opening Markdown files and tested adding an empty array of embeded highlight languages. I found this saves 1–1.4 seconds off of my load time even when loading a file that has no code block syntax at all. Obviously this isn't my only speed problem, but I do think we should figure out how to only do whatever this costly operation is after running into codeblock syntax.

alerque avatar Sep 11 '19 05:09 alerque