Monday, September 15, 2014

Re: Optimizing syntax file for Lauterbach T32 Practice script.

On Mo, 15 Sep 2014, RedX2501 wrote:

> Hello,
>
> I have written a syntax file for the Lauterbach T32 Practice script language.
>
> Unfortunately it is very slow. I was wondering if you could give me a few hints on how to optimize it.
>
> The main thing with this language is that it has MANY keywords and fixed word combinations.
>
> What is the best way to match that?
>
> I have attached my current version so you get an idea of what i'm talking about.

I don't know much about syntax writing. However I have a couple of
ideas, but they need at least Vim 7.4

I believe keywords are much cheaper than using syn match. So you might
try that. Second, if possible try to avoid assertions, they might slow
down regex matching considerably, you might however try to restrict the
assertions by some bytes, this might speed up matching a little (use the
\@123 version of the atom).

If you have many alternations '\|' like in your syntax script, try to
force matching using the old engine. I believe this is faster (see :h
\%#=)

And at last, use the new :syntime command to measure performance and
figure out, which ones is the most costly regex. So you will be able to
tune specific patterns better.

Best,
Christian
--
Lieber voll heimkommen, als leer ausgehen.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: